473,715 Members | 6,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5700
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:absol ute", and the floats will work.
Get rid of "position:relat ive" 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
5011
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 have their centers vertically aligned, I was thinking of using a fixed width container with one image floated left and one right with the images centered in their respective boxes and then the same down the page. I am using a table to obtain the...
7
2732
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 grokking CSS positioning): http://unifiedmind.com/images/css-example.gif In this example, boxes one and two are wrapped in a box that is 100% wide.
5
8101
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 First colum: 100% height; 200px width; float: left Second colum: 100% height; 200px width; float: right Third colum: 100% height And here I stop, because nothing seems to work in order to set correctly
7
1859
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 specified, or something. HELP??? http://wholives.com/temp/cssr.htm Thanks,
2
2678
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 in the html? Consider this situation. In the website I run, I use two column liquid layout modeled after the one here: http://www.alistapart.com/articles/negativemargins/
7
2403
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 good. now in 2.0 I'm using the default placeholder and putting a table in the placeholder and putting controls in the cells in the table. "the way it is supposed to be done" I have a textbox in a table that is defined as follows... <td...
5
2405
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 properties for Left and Right, but not for Centering. So my question is How does one center an image to the Browser window? I was thinking about converting a page for my friends catering. It's a table center in the
2
16416
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 to overlap correctly. You can see it on this page: www.creativekaysjewelry.com The images overlap exactly how I wanted and in the right position
5
13373
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 http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
8823
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8718
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9343
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9198
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9104
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7973
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5967
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.