Jump to content

How can I use <dd> within <dd> (definition lists)?


Banath

Recommended Posts

I am attempting a practice assignment and it calls for the use of definition lists. I don't think this is covered in the course, but maybe someone can help.

This is what I want to achieve: http://clouni.com/assignments/HTML5-Assignment.pdf (It is assignment 4).

It should appear this way (The red represents the problem area):

Fruit

Apples, Oranges, Pears, Pineapples

Vegetables

Corn

on the cob

cream

Carrots

Green Beans

<dl>			<dt><u>Fruit</u></dt>				<dd>Apples, Oranges, Pears, Pineapples</dd>			<dt><u>Vegetables</u></dt>				<dd>Corn</dd>					<dd><em>on the cob</em></dd>					<dd><em>cream</em></dd>				<dd>Carrots</dd>				<dd>Green Beans</dd>				</dl>		</dl>	
Edited by Banath
Link to comment
Share on other sites

I'd structure it this way:

<dl>    <dt>Vegetables</dt>    <dd>        <dl>            <dt>Corn</dt>            <dd>On the cob</dd>            <dd>Cream</dd>        </dl>    </dd></dl>

Don't use <u> or <em> to style things. Use class names and selectors to target elements and style them with CSS.

Link to comment
Share on other sites

Maybe...

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>title</title><style>dl.top > dt{text-decoration: underline;color:red;}dl dd dl dd{font-style:italic;color:blue;}</style></head><body><dl class="top">  <dt>Fruit</dt>  <dd>Apples, Oranges, Pears, Pineapples</dd>  <dt>Vegetables</dt>  <dd>    <dl>      <dt>Corn</dt>      <dd>on the cob</dd>      <dd>cream</dd>    </dl>  </dd>  <dd>Carrots</dd>  <dd>Green Beans</dd></dl></body></html>
Edited by davej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...