473,691 Members | 1,863 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 5155
"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
4174
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
6881
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
9532
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
4482
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
7051
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
8535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9079
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
8952
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
8793
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
8796
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6457
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5817
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
4553
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2234
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.