Reputation: 141
I'm trying to CSS style some HTML to look like the following image. I've decided to use a definition list with some classes to do this.
I'm trying to
dd
styling so that it is all the way to the left. Here is my HTML:
<dl>
<dt>Classic Italian Hoagie</dt>
<dd class="price">$8</dd>
<dd class="desc">Pepperoni, salimi, capicola, banana peppers, romaine, tomatoes, provolone & housemade olive oil & herb vinaigrette on a hoagie bun</dd>
</dl>
Upvotes: 1
Views: 3996
Reputation: 53991
To answer the first part of your question, floating the dt
and the .price
to the left will line them up next to one another.
You can then get the other dd
tags to clear:left
which solves your problem.
dt, .price{
float:left;
clear:none;
margin-right:5px;
}
dd{
clear:left;
}
As for your second question, I don't see any default styling causing margins on the dd
. It looks as required for me but if not you can always put a margin-left:0;
on the dd
.
Upvotes: 2