473,416 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

positioning images in left, center & right floated formation

Hi, I'm trying to do something that has always been easy with tables -
namely use a three column layout, and above the main layout, show three
images - one on the absolute left, one on the absolute right, and one
in the middle. The one in the middle needs to be centered, as various
browsers display slightly differently.

However, using the CSS and code below, either the first image is not
shown (IE) or the right image is shown below (Firefox).

I really can't figure out what is the problem:

CSS:

#logobar {position: relative;
left:0px;
width:auto;
height:23px;
border: none;
text-align: center;
}

#l {position: absolute;
float:left;
width:153px;
margin:auto;
}

#c {position: relative;
margin:auto;
width: auto;
vertical-align: middle;
background: white;
text-align: center;

}

#r {position: absolute;
float:right;
right: 0px;
width:-152px;
margin: auto;

}
HTML:

<div id="logobar">

<span id="l"><img src="images/l1.gif"></span>
<span id="c"><img src="images/m1.gif"></span>
<span id="r"><img src="images/r1.gif"></span>
</div>

Any suggestions ?

Thanks
SS.

Jul 21 '05 #1
2 5678
Els
sylvian stone wrote:
Hi, I'm trying to do something that has always been easy with tables -
namely use a three column layout, and above the main layout, show three
images - one on the absolute left, one on the absolute right, and one
in the middle. The one in the middle needs to be centered, as various
browsers display slightly differently.

However, using the CSS and code below, either the first image is not
shown (IE) or the right image is shown below (Firefox).

I really can't figure out what is the problem:

CSS:

#logobar {position: relative;
left:0px;
width:auto;
height:23px;
border: none;
text-align: center;
}

#l {position: absolute;
float:left;
width:153px;
margin:auto;
}

#c {position: relative;
margin:auto;
width: auto;
vertical-align: middle;
background: white;
text-align: center;

}

#r {position: absolute;
float:right;
right: 0px;
width:-152px;
margin: auto;

}
HTML:

<div id="logobar">

<span id="l"><img src="images/l1.gif"></span>
<span id="c"><img src="images/m1.gif"></span>
<span id="r"><img src="images/r1.gif"></span>
</div>

Any suggestions ?


Yes.
/resists temptation of giving the yes/no link

You should not mix position with float.
Get rid of "position:absolute", and the floats will work.
Get rid of "position:relative" on #c, and place <span id="c"> below
the two floats.
Also, on #c: both width and margin set to auto makes no sense afaics.
<span>s don't use a width, unless you set them to be block elements.
To have the image centered inside #c, I'd use a div, not a span.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos văo. O resto é imperfeito.
- Renato Russo -
Now playing: Duran - Ordinary World
Jul 21 '05 #2
sylvian stone wrote:
Hi, I'm trying to do something that has always been easy with
tables - namely use a three column layout, and above the main
layout, show three images - one on the absolute left, one on the
absolute right, and one in the middle. The one in the middle needs
to be centered, as various browsers display slightly differently.


http://home.rochester.rr.com/bshagnasty/banner.html

--
-bts
-This space intentionally left blank.
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Grytpype-Thynne | last post by:
Is it possible to give a width to a floated div which is greater than the width of the image it contains? What I want to do is display some images which will be of different sizes so that they...
7
by: James Thornton | last post by:
I'm trying to make the transition from tables to CSS, and I need someone to explain how to achieve the following layout (understanding the concepts behind this layout will help me considerably in...
5
by: Joy | last post by:
Hi guys, I am in a tricky situation, I really really hope someone will help me. I got a layout with a main container and three colums inside. Main container: 100% height; 90% width; float: left...
7
by: theo | last post by:
Please, Why is this wide 6px border showing up where it is. It's supposed to be at the bottom of the page, inside of base div. I'm positioning wrong, something needs to cleared or x-index...
2
by: Viken Karaguesian | last post by:
Hello all, This question is half css and half html based, so I chose this group. I have a theortical question. When positioning floating <div>'s, how much does it matter what order you put itin...
7
by: GaryDean | last post by:
In my old 1.1 apps the default was MS_POSITIONING="GridLayout" and Textboxes and labels and such always had POSITION: absolute; and I never had any distortion when the page was rendered. Life was...
5
by: Howard | last post by:
I have seen a lot of examples of 2 & 3 Collumn layout schemes. But I have not yet found any examples for positioning images and centering them by the browser. I notice that there are CSS...
2
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.