473,698 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which content for <li>

Hi!

A stupid question (I think I have to read the spec more detailed): what kind
of content is allowed for <li>-Elements? Is this valid html:

<ul>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
</ul>

TIA

Bernd
Jul 23 '05 #1
4 5156
"Bernd Schlingenkamp" <be************ *****@hotmail.c om> wrote:
Hi!

A stupid question (I think I have to read the spec more detailed): what kind
of content is allowed for <li>-Elements? Is this valid html:

<ul>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
</ul>


Yes. http://www.w3.org/TR/html4/sgml/dtd.html

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #2
Bernd Schlingenkamp wrote:
Hi!

A stupid question (I think I have to read the spec more detailed): what kind
of content is allowed for <li>-Elements?
You do need to read the spec, where it's very clear:

http://www.w3.org/TR/html401/struct/lists.html#h-10.2

states %flow as legal content for <li>, and the DTD:

http://www.w3.org/TR/html401/sgml/dtd.html#flow

defines %flow as any block or inline element.

Is this valid html:

<ul>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
</ul>


Yes.

--
Mark.
http://tranchant.plus.com/
Jul 23 '05 #3
"Bernd Schlingenkamp" <be************ *****@hotmail.c om> wrote:
Is this valid html:

<ul>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
<li><div>someco ntent</div></li>
</ul>


As others have said, it is valid. But I wonder why you ask. Why would you
like to use the <div> markup? It has no visual effect by default - inside
<li> elements, since each list item starts on a new line anyway - and it
has no semantic meaning. But it could be used for various tricks - e.g.,
if you wish to make list bullets red without affecting text color, you
could make the <ul> element's text color red but the color of <div>
elements inside <li> elements black (or whatever). And there's nothing
syntactically wrong with such tricks.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #4
Okay, thank you all for your advice.
As others have said, it is valid. But I wonder why you ask. Why would you
like to use the <div> markup? It has no visual effect by default - inside
<li> elements, since each list item starts on a new line anyway - and it
has no semantic meaning. But it could be used for various tricks - e.g.,
if you wish to make list bullets red without affecting text color, you
could make the <ul> element's text color red but the color of <div>
elements inside <li> elements black (or whatever). And there's nothing
syntactically wrong with such tricks.


The idea behind this is to make a special kind of menu. Lists can be
arranged inline, horizontally. So, with divs you could arrange a container
just along the topic-entries.

Bernd
Jul 23 '05 #5

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

Similar topics

3
4175
by: Kelvin | last post by:
Basically, my texts consists of normal text stream and some quotations. This is my text stream, and inside "this streams" there are some "quotation pairs" which are to be replaced like this: <LI>this streams</LI> for formatting in HTML. Tried ___s/\".*?\"/<li>.*?<\/li>/g;___ but not working. Thanks.
8
6882
by: Michael | last post by:
This is a two-part question to which I haven't been able to find an answer anywhere else. 1. Is it possible to format the bullet/number character of the <li>? In my styles sheet, I have the <li> tag formatted, for example, bold. However, when it's applied, the number of the <li> is not bold, but the text is. Do I have to apply the bold to the <ol> instead? 2. When I use <li>example text</li>, and when I insert a <br> after the </li>,...
5
9244
by: toylet | last post by:
Attached is some css codes for a website. It has 3 parts: top-bar, side-bar (on the left) and main-body. The top-bar has a mouseover menu called top-menu implemented via ul:hover. When the mouse pointer hovers over the top-menu, the bottom margin of the top-bar expands downwards. How could I make the hover menu to stack on top of the main-body, not expanding the bottom margin of the top-bar? I believe it has something to do with...
4
9533
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window in IE, the last item in the list has a nasty tendency to wrap down to the next line (and stay there). I can hack it (imperfectly) by setting the width of the list items to
2
7629
by: Shaun | last post by:
Hello! I have a quick question regarding CSS and having it applied to all elements. I am trying to eliminate the gap between a paragraph and a list that usually occurs in html and I've found away to do that with this code: <p>a</p> <ul style="margin-top: -20; padding-top: 0"> <li>1</li>
2
2570
by: Andrew Donaldson | last post by:
I'd welcome some help in understanding what's going on with graphical browsers in the navigation list at: http://www.bounceandtickle.org.uk/index.html (This site is not about what it might seem from the URL!) I'm using a <ul> for the gimmicky teddy bear links. The teddy is a background image for each <li>. Each link 'button' is an <a> within an <li>, and I'm trying to get the button to appear partway down the teddy
5
4483
by: Syl | last post by:
Hello experts!! The top menu navigation bar displays perfectly in IE, but does not display properly in Mozilla or Netscape : http://checkeredshirt.com/textonly.html For some reason the non-IE browers are forcing the top navigation menu to dislpay "staggered" after the the first <ul><lielement. Can anyone see why this is happening ?
9
3477
by: eros | last post by:
<li>List <ul> <li>List1</li> <li>List2</li> <li>List3</li> </ul> </li> How to call the php code from that html tags... when I click List1?
2
7053
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so the entire block is clickable, not just the text. I've sorta got it so it's clickable, just some parts of the button I still can't click on. The website is http://pdhtdev.johnabbott.qc.ca/students/2010/james_mann/portfolio/index.htm The css...
0
9164
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
9029
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
8898
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
5860
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();...
0
4370
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
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
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.