Link to home
Create AccountLog in
Avatar of itinfserv
itinfserv

asked on

xhtml list

I try to use this code and validate to xhtml
<html>
<body>
<ul>
<li>test 1</li>
<li>test 2</li>
<li>
	<ul><li>test 3</li></ul>
</li>

</ul>
</body>
</html>

Open in new window

it validates ok, but i want test 3 to be idented to the right from test 1 and test 2. if i change the code to
<html>
<body>
<ul>
<li>test 1</li>
<li>test 2</li>
	<ul><li>test 3</li></ul>
</ul>
</body>
</html>

Open in new window

the result is as i wish, but it would fail the xHTML validation.
Avatar of iGottZ
iGottZ
Flag of Germany image

http://www.w3.org/QA/2002/04/valid-dtd-list.html
you need a valid doctype in order to validate your source.

besides both of your snippets are not well formed.
the bottom one is invalid.
Avatar of itinfserv
itinfserv

ASKER

Thanks for your answer.

I'm using
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

Open in new window


and I know the second one is invalid. but it generates the result I want.

I attach image of what I'm after.
test.JPG
ASKER CERTIFIED SOLUTION
Avatar of Designbyonyx
Designbyonyx
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
As Designbyonyx showed, the sub-list needs to be the child of one of the list-items (<li>) of the parent list.