Jump to content

how do center image


kartul

Recommended Posts

first, this ain't so easy as it sounds  :D

 

second, code is:

<p class="searchbar"> 
      <span style="float: left;"><a href="">View unanswered posts</a> | <a href="">View active topics</a></span> 
      <span style="float: left;"><img src="./styles/hestia/imageset/bars/donationbar.png" alt="Donations received so far"/></span> 
      <span style="float: right;"><a href="">View new posts</a> | <a href="">View your posts</a></span> 
</p>

well, as you can see, its style from phpBB3. I need to center this image at line 3. so far I have tried everything that as come to my mind. I know that, float must be left or right. otherwise the 4th line will be on another line in browser. I've tried with div, margin 0 auto, center tags, text-align. nothing worked so far. so, is there a way to make it appear center?

to make it more visual:

right now:

View unanswered posts | View active topics[image] ................................................. ....................View new posts | View your posts

but i need:

View unanswered posts | View active topics..................................[image]....................................View new posts | View your posts

 

so, is there any way to do it..?

Link to comment
Share on other sites

And you're sure this doesnt work?:

<span style="float: left;"><center><img src="./styles/hestia/imageset/bars/donationbar.png" alt="Donations received so far"></img></center></span>

hmm.. how do say, almost...

the 4th line goes to new line when I use this. but image IS in right place.

visually:

View unanswered posts | View active topics..................................................[image].................................................................

...View new posts | View your posts

Link to comment
Share on other sites

Hi,

Have you tried something like this:

<p class="searchbar">
      <span style="float: left; width:30%;"><a href="">View unanswered posts</a> | <a href="">View active topics</a></span>
      <span style="float: left;width:40%; text-align:center;"><img src="./styles/hestia/imageset/bars/donationbar.png" alt="Donations received so far" style="margin:0px auto;"/></span>
      <span style="float: right; width:30%;"><a href="">View new posts</a> | <a href="">View your posts</a></span>
</p>

Chris

Link to comment
Share on other sites

could you do me a favour.. im having trouble visualising where you want everything to sit.. could you use paintshop or anything like that and just draw boxes of where everything should be and what is essential.. for example.. does it have to be floated left ?

 

I have done this at my best guess

 

<p class="searchbar">
      <span style="float: left;"><a href="">View unanswered posts</a> | <a href="">View active topics</a></span>
      <div align="center"><img src="./styles/hestia/imageset/bars/donationbar.png" alt="Donations received so far"/></div>
      <span style="float: right;"><a href="">View new posts</a> | <a href="">View your posts</a></span>
</p>

Link to comment
Share on other sites

You can do it by rearranging your elements and adding a rule to the searchbar css.

I wrote it inline, remove add what you need.

 

<p class="searchbar" style="text-align:center; border:1px solid #000; padding:5px;">
<span style="float: left;"><a href="">View unanswered posts</a> | <a href="">View active topics</a></span> 
<span style="float: right;"><a href="">View new posts</a> | <a href="">View your posts</a></span> 
<img src="./styles/hestia/imageset/bars/donationbar.png" alt="Donations received so far" />
</p>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.