View Full Version : linebreak and lists?
2nd day
February 24th, 2006, 09:08 AM
Hi there,
im having trouble with some lists im working with... this is my htmlcode:
<p>this is a list:
<ul>
<li>asd</li>
<li>asdasd</li>
<li>asd<br></li>
</ul>
</p>
my problem is the empty line after 'this is a list'... i was wondering how to get rid of it, or how to work around the problem...
thanks!
thebloodpoolkid
February 24th, 2006, 11:17 AM
You can set "this is a list" as a list item as well.
<ul>
<li id="title">this is a list</li>
<li>asd</li>
<li>asdasd</li>
<li>asd<br></li>
</ul>
and in CSS put
#title {
margin-left: -5px;
}
This would cause the first item in the list which is "this is a list" to be offset to the left by 5px. This is more than likely not the best way of doing and far from the only way.
DDD
February 24th, 2006, 12:42 PM
I would do what bpk did or you can use the <br /> tag with a span around the text if you need it out of the ul also you can put a style on that p tag. There is a few ways to do this.
bwh2
February 24th, 2006, 12:54 PM
well, bpk's way is a hack not because of presentation, but because of info hierarchy. a list's title isn't an element in the list. here's what i would do:
<h1>this is a list:</h1>
<ul>
<li>asd</li>
<li>asdasd</li>
<li>asd</li>
</ul>
h1 {
margin-bottom: 0;
}
ul {
margin-top: 0;
}
thebloodpoolkid
February 24th, 2006, 01:06 PM
well, bpk's way is a hack not because of presentation, but because of info hierarchy. a list's title isn't an element in the list. i would put the p's bottom margin to zero and the ul's top margin to 0 (or whatever you want).
True. I should have mentioned that. Your suggestion is more sensible as well.
2nd day
February 26th, 2006, 09:44 AM
thanks a lot guys, i used bwh2's approach... thanks a lot!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.