Reputation: 35
I need to get multiple information on the same line this:
Name: Robert Age: 10 Gender: Male
Where the labels are different colors from the value. How would I do this?
Upvotes: 1
Views: 1939
Reputation: 78696
The dt
and dd
tags have display: block
set from the browser. Just reset that to display: inline
or inline-block
to make them on the same line.
dt, dd {
display: inline-block;
margin: 0;
}
dt {
font-weight: bold;
}
dt:after {
content: ":";
}
<dl>
<dt>Name</dt>
<dd>Robert</dd>
<dt>Age</dt>
<dd>10</dd>
<dt>Gender</dt>
<dd>Male</dd>
</dl>
Upvotes: 4