473,415 Members | 1,562 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,415 software developers and data experts.

List Next to a Floating Block

I sometimes place a sidebar on a Web page, using the following:
..sideright { float: right;
background-color: #fff;
width: 40%;
font-size: 90%;
text-align: justify;
margin-left: 1em;
padding: 2% }
..sideleft { float: left;
background-color: #fff;
width: 40%;
font-size: 90%;
text-align: justify;
margin-right: 1em;
padding: 2% }

If I have an unordered list <ul><li></ul> to the left of a right
sidebar, everything looks okay. If I try an unordered list to the
right of a left sidebar, however, the bullets overlap the
sidebar's block. I have no problems with unordered lists within
either left or right sidebars.

My entire style sheet file passes the test at
<http://www.htmlhelp.com/tools/csscheck/> with no errors. The
only warnings suggest such things as combining background-color
with background-image into just background.

Do I need to change my sidebar definitions? Or is there something
I should do about unordered lists? My list style is
li { list-style-position: outside }
ul li { list-style-type: disc;
display: list-item;
margin-top: 1em }
ul ul li { list-style-type: circle;
display: list-item;
margin-top: 0em }

I'm sorry, but I don't have an example of my problem. When I saw
what was happening, I changed the affected left sidebars to right
sidebars.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone snooping into your E-mail?
Use PGP. See my <http://www.rossde.com/PGP/>
Jul 20 '05 #1
3 5466
In article David Ross wrote:
I sometimes place a sidebar on a Web page, using the following:
.sideleft { float: left;width:40%;margin-right: 1em;}

If I have an unordered list <ul><li></ul> to the left of a right
sidebar, everything looks okay. If I try an unordered list to the
right of a left sidebar, however, the bullets overlap the
sidebar's block. I have no problems with unordered lists within
either left or right sidebars.
Add big enaugh right margin for float (2em?). Or if you are somewhat sure
that your list will end before sidebar, and some extra left margin to li.

Since no browser supports the CSS2 way to do lists, there is not much
else you can do. Not that it would help much.

I never stop wondering why they IE & Co desided to draw bullets to ul
margin, I would think li padding would make much more sence.
I'm sorry, but I don't have an example of my problem. When I saw
what was happening, I changed the affected left sidebars to right
sidebars.


And never thought to make text case elsewhere? Think that next time, it
would make it clear for people not seen the effect.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #2
Lauri Raittila wrote:

In article David Ross wrote:
I sometimes place a sidebar on a Web page, using the following:
.sideleft { float: left;width:40%;margin-right: 1em;}

If I have an unordered list <ul><li></ul> to the left of a right
sidebar, everything looks okay. If I try an unordered list to the
right of a left sidebar, however, the bullets overlap the
sidebar's block. I have no problems with unordered lists within
either left or right sidebars.


Add big enaugh right margin for float (2em?). Or if you are somewhat sure
that your list will end before sidebar, and some extra left margin to li.

Since no browser supports the CSS2 way to do lists, there is not much
else you can do. Not that it would help much.

I never stop wondering why they IE & Co desided to draw bullets to ul
margin, I would think li padding would make much more sence.
I'm sorry, but I don't have an example of my problem. When I saw
what was happening, I changed the affected left sidebars to right
sidebars.


And never thought to make text case elsewhere? Think that next time, it
would make it clear for people not seen the effect.


Actually, I'm using Mozilla 1.5. Bullets for an unordered list
normally appear indented by 3 em from the block's left edge with
the following text separated from the bullet by another em.

However, to the right of a left sidebar, the list-item text lines
up with paragraphs outside of the unordered list. The bullet is
worse than not indented. Relative to those paragraphs, the bullet
seems to have a -1em left margin.

I have created a test page at <http://www.rossde.com/test.html>.
It refers to my style sheet at
<http://www.rossde.com/genl_style.css>. I specified {
font-family: monospace } so that the alignment of characters can
be determined. Per suggestion, I set { margin-right: 2em } for
the sidebar. The sidebar contains only the word "text" repeated
over and over. Outside the sidebar, there should be a paragraph
above the sidebar and one to the right of the sidebar. Following
the second paragraph, I have an unordered list with two list-items
followed by text without a <p> and then four short paragraphs.
When I use Mozilla 1.5 to view this, the first letter of each
list-item lines up with the first letter of the paragraph before
the list; the bullets stick out to the left.

If this is a Mozilla problem, please let me know so that I can
submit a bug report.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone snooping into your E-mail?
Use PGP. See my <http://www.rossde.com/PGP/>
Jul 20 '05 #3
In article David Ross wrote:
Lauri Raittila wrote:

In article David Ross wrote:
I sometimes place a sidebar on a Web page, using the following:
.sideleft { float: left;width:40%;margin-right: 1em;}

If I have an unordered list <ul><li></ul> to the left of a right
sidebar, everything looks okay. If I try an unordered list to the
right of a left sidebar, however, the bullets overlap the
sidebar's block. I have no problems with unordered lists within
either left or right sidebars.
Add big enaugh right margin for float (2em?). Or if you are somewhat sure
that your list will end before sidebar, and some extra left margin to li.

Since no browser supports the CSS2 way to do lists, there is not much
else you can do. Not that it would help much.
I checked that again, and it would not help at all.
And never thought to make text case elsewhere? Think that next time, it
would make it clear for people not seen the effect.


Actually, I'm using Mozilla 1.5. Bullets for an unordered list
normally appear indented by 3 em from the block's left edge with
the following text separated from the bullet by another em.


Yes.
However, to the right of a left sidebar, the list-item text lines
up with paragraphs outside of the unordered list. The bullet is
worse than not indented. Relative to those paragraphs, the bullet
seems to have a -1em left margin.
Proplem of CSS box modell that don't specify list-items and floats, and
of browser implementors that didn't do anything more sencible.

In your test case
body > ul > li, body > ol > li {margin-left:45%;}

Helps, with exactly that content. But if you have shorter left dide
thing, it will break.

There unfortunately is no good solution to this.

li {list-style:inside !important;}

Will help, but it will make list look stupider.

You could play with :before, content:"\2022" and float, and get adequate
results, but CSS2 spec says that float don't apply to generated content
and so it don't work either. CSS21 corrects this stupid limitation. That
was even implemented (and then fixed)

Another aproach is

ul, ol {display:inline-block;}

That works on Opera 7 and only Opera 7, and only when you use markup
where there is no bare text like "This is text beyond the unordered
list." after or before lists.

But this has the same problem as overly big li margin, that list will not
use spce under left float. Advantage is that you don't need to know width
of side thing.
If this is a Mozilla problem, please let me know so that I can
submit a bug report.


The biggest problem is that it is not a really bug, so it can't be easily
fixed. And that it happens on all browsers. And that more correct
behaviour by spec would be having that bullet on left side of that left
floating thing. (and as there is margin/padding in ul, under that left
float.)
http://www.w3.org/TR/CSS2/generate.html#markers

So if you can think aproach that would not need total rewrite of CSS box
model, I think it could be good to hear about it. I have not looked CSS3,
so I don't know if someone has already found best way, but I don't think
so.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #4

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

Similar topics

12
by: Dave Brown | last post by:
Hi all, Is it possible to have 4 LI items in a <UL> with the LI width set to width:25% so that each one sizes to 25% of whatever its container width is ? It doesnt seem so, the width doesnt...
2
by: steven | last post by:
Hi, sorry for the crosspost, but I'm not sure if my problem is with the HTML or the CSS :-( URL: http://www.nenya.be/temp/list.htm I have a list with in each list item a text + link which are...
0
by: Bart Lateur | last post by:
This seems so basic, but the common browsers (in particular Firefox and MSIE on Windows) succeed to mess it up. The basic HTML is this: <!-- an image floating on the left --> <img...
6
by: David M. Synck | last post by:
Hi all, I am fairly new to Python and trying to figure out a syntax error concerning lists and iteration through the same. What I am trying to do is sum a list of float values and store the sum...
7
by: David Trimboli | last post by:
Suppose I've got HTML with the following in it: <ul class="navigation"> <li><a href="chapter1.html" title="Chapter 1">Previous</a></li> <li><a href="./">Contents</a></li> <li><a...
22
by: ashkaan57 | last post by:
Hi, I am trying to put text on left and right side of the page and used: <div> <span>blah blah</span> <span style="float:right">blah blah</span> </div> The 2nd text does go to the right but the...
6
by: Harlan Messinger | last post by:
Please take a look at http://www.gavelcade.com/list_next_to_float.html How can I style a list so that if it appears next to a left-floated box as the first list does in this example, the list...
6
by: Jeremy | last post by:
I've got a floating div which becomes visible when a link is clicked. I want the div to be hidden when the user clicks anywhere on the page except for whithin the div. What is the best way to do...
4
by: Keith Hughitt | last post by:
For example, If you have a list: <ul> <li>item 1 is short.</li> <li>item 2 is a little bit longer</li> </ul> regardless of the size of the contents of each list item, the element
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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.