In article
<1191201410.293502.91520 (AT) d55g2000hsg (DOT) googlegroups.com>,
shapper <mdmoura (AT) gmail (DOT) com> wrote:
Quote:
Hello,
I have the following HTML:
div id = "content" class = "content" |
Why both id and class?
Quote:
Basically, I want to make the list items to be side by side. I want
the list to be 400px with. |
Which means it will break badly when font-size is adjusted by the
user.
Quote:
First item should have 40% of the width and second item 60%.
li.first
{
width: 40%;
}
li.first
{
width: 60%;
} |
Notice that you have "first" twice here? A typo?
Quote:
Why overflow?
I have no idea but when I don't use this the list gets wider then
the container div |
Did you ask these questions and answer them? Where did the
questions come from? Perhaps you do not know that some of us do
not use Google. At least I see no other posts in this thread?
Maybe it is just my newsreader?
Quote:
Why margin and passing set to 0?
I also don't know but if I don't use it I get a space between the
div and the list. |
One thing to watch out for is that list items have markers and
these are defaulted by padding/margin differently in different
browsers - *even* when no list items are displayed. You can zero
these out and set your own margins. See my example later.
Quote:
Finally, I am not able to set the width of both list items. |
Look at this:
One thing to watch out for is that list items have markers and
these are defaulted by padding/margin differently in different
browsers - *even* when no list items are displayed. You can zero
these out and set your own margins. See later.
Look at this html:
<ul>
<li class="first">first item</li><li class="second">second
item</li>
</ul>
and now look at this css:
* {margin: 0; padding: 0;}
ul {
list-style-type: none;
width: 400px;
border: 1px dotted #999;
}
li {
background: #ccc;}
li.first {
width: 40%;
background: #fcc;
}
li.second {
width: 60%;
background: #ccf;
}
You will see that the percentages here work, at least in respect
to the list item area (the text will overflow at big user font
adjustment). But as soon as you add display: inline; to the li
css, you are turning these into objects like words in text,
inline objects; width control is now set by the content...
if you need so much control, forget about inline lists, it may be
easier for you to use just divs, and float them all left,
supplying widths and appropriate left margins.
Or best of all, by all means use the inline lists, useful things,
but forget about trying to tame their individual percentage
widths, let them find their own, just set margins and paddings
and you can make them look nice. Forget about making a design
that "requirs" the ul or its container to be 400px wide. You are
storing up trouble.
--
dorayme