473,473 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

UL border

Hi,

In the following code:
<UL STYLE="border: 2px solid #F00000;">
<LI STYLE="border: 1px solid #00F000;">item 1</LI>
<LI STYLE="border: 1px solid #00F000;">item 2</LI>
<LI STYLE="border: 1px solid #00F000;">item 3</LI>
</UL>

The red border clearly surounds the whole list, including the LI
elements, which looks correct to me,
but if I declare the LI elements float:left , they do not appear
included inside the UL border anymore:

<UL STYLE="border: 2px solid #F00000;">
<LI STYLE="border: 1px solid #00F000;float:left;">item 1</LI>
<LI STYLE="border: 1px solid #00F000;float:left;">item 2</LI>
<LI STYLE="border: 1px solid #00F000;float:left;">item 3</LI>
</UL>

This happens in both IE and FireFox.
Is it normal Doc?

Jul 21 '05 #1
7 22026
Els
Claude Schneegans wrote:
Hi,

In the following code:
<UL STYLE="border: 2px solid #F00000;">
<LI STYLE="border: 1px solid #00F000;">item 1</LI>
<LI STYLE="border: 1px solid #00F000;">item 2</LI>
<LI STYLE="border: 1px solid #00F000;">item 3</LI>
</UL>

The red border clearly surounds the whole list, including the LI
elements, which looks correct to me,
but if I declare the LI elements float:left , they do not appear
included inside the UL border anymore:

<UL STYLE="border: 2px solid #F00000;">
<LI STYLE="border: 1px solid #00F000;float:left;">item 1</LI>
<LI STYLE="border: 1px solid #00F000;float:left;">item 2</LI>
<LI STYLE="border: 1px solid #00F000;float:left;">item 3</LI>
</UL>

This happens in both IE and FireFox.
Is it normal Doc?


You asked this already before I think?
Anyway - yes, it's normal, but I'm not Doc ;-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #2
Hi,
You asked this already before I think?
I did, but I didn't get my own message, so I was not sure.
yes, it's normal, but I'm not Doc


Ok, let's say it is, but how come it is ?
I don't see why in the second case the border should not include the content.
Jul 21 '05 #3
Claude Schneegans wrote:
Hi,
You asked this already before I think?
I did, but I didn't get my own message, so I was not sure.
yes, it's normal, but I'm not Doc


Ok, let's say it is, but how come it is ?
I don't see why in the second case the border should not include the
content.

Floated boxes are not included as 'box content' when the height of <ul> is
calculated - unless there is an element with 'clear: both' in the <ul> and
after all floats that is pushed below the floats and forces the <ul> bottom
edge further down.
This is not specific to <ul>s/<li>s.
You might try 'overflow: auto' on the <ul>.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 21 '05 #4
Claude Schneegans <sc********@internetique.com> wrote:
Ok, let's say it is, but how come it is ?


Because you declared the LI elements as "float" and "floats" are no
ordinary blocks. "Floats" are removed from the normal flow, so nothing
(that is treated as "normal flow") is left inside the UL element.

For more information, please read the section about "floats" in the CSS
specification: <http://www.w3.org/TR/REC-CSS2/visuren.html#floats>

--
Alexander
Jul 21 '05 #5
>Because you declared the LI elements as "float" and "floats" are no
ordinary blocks. "Floats" are removed from the normal flow, so nothing
(that is treated as "normal flow") is left inside the UL element.


Ah ok, thanks.
All what I want is having the LI elements side by side on the same line.
Is there another way to get the same result and still have them inside the UL.

I got around the problem temporarilly by giving a height to the UL, but I'd rather have this height automatic.
Jul 21 '05 #6
Els
Claude Schneegans wrote:
All what I want is having the LI elements side by side on the same line.
Is there another way to get the same result and still have them inside the UL.


Replace 'float:left' with 'display:inline' (and 'text-align:left' if
necessary).

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Madness - The Sun and the Rain
Jul 21 '05 #7
>>Replace 'float:left' with 'display:inline'

Ah ah! Very good thank you.
Jul 21 '05 #8

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

Similar topics

33
by: Thomas Mlynarczyk | last post by:
Hi, I'm looking for a way to put a 1px solid border around the image in this link: <a href="some.html"><img src="some.gif"></a> Well, that, by itself, is simple. However, I would like to have a...
0
by: yurps | last post by:
Hello here is my html, if you click the missing image in the first column on the left, the div is shown, when clicked again the div disappears...but the bottom border disappears as well...Is there...
3
by: ireneatngs | last post by:
Hi, I have example html below which contains a couple of hidden divs. However, some of the table borders within these hidden divs are actually displayed when they should not be. In my...
7
by: Bob Bedford | last post by:
I've an image in a cell of a table. I've this CSS: ..dbtable{ width: 600px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; border-collapse: collapse; border: 1px solid #000000;
23
by: Bob Bedford | last post by:
I've a table. The table must not have any border. The TR (every line) must have a border, but not the lines between cells. The TR.pages must have no border. so .mytable{border:0px;} ...
2
by: Jon | last post by:
Hi all, I am trying to create a page that contains a number of div elements, with links on the left side of the page allowing the user to select which div to display. Some of the pages contain...
19
by: Eva | last post by:
Hi, I'm really really really new to javascripts and so i couldn't really comprehend thoroughly on the the previous posts regarding this issue. Anyways, I'm setting up a picture album site....
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
3
by: Alex Maghen | last post by:
I'd like there to be a border around each row of my data-grid but NOT between the columns. I've tried setting BorderColor="Black" BorderStyle="Solid" BorderWidth="1px"...
16
by: FuzzyLogik | last post by:
By width, I don't mean weight. I have a row of <li>'s, with a bottom-border. I want the bottom-border to only go 90% of the <li> (centered) Is there any way to do this? I have it in this...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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,...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.