<code> element incorrectly styled as a block element
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-website-content |
Fix Released
|
Low
|
Anthony Dillon |
Bug Description
In <http://
This is because of an error in <http://
code, pre {
backgroun
-
-
display: block;
border-
font-family: "Ubuntu Monospace", "Ubuntu Mono Regular", "Lucida Console", "Monaco",
"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier,
monospace;
font-size: .8em;
padding: 1.25em;
margin-
}
code {
margin-top: 1.25em;
}
The <code> element is a phrasing element -- the same as <b>, <i>, <em>, <var>, and so on -- so it should not be styled with {display: block}, or any of the border, background, or margin properties that assume it is a block. <http://
This could be fixed as follows:
code, pre {
font-family: "Ubuntu Monospace", "Ubuntu Mono Regular", "Lucida Console", "Monaco",
"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier,
monospace;
font-size: .8em;
}
pre {
backgroun
border-
margin: 1.25em 0;
padding: 1.25em;
}
Related branches
Changed in ubuntu-website-content: | |
assignee: | nobody → Graham Bancroft (gbancroft-canonical) |
Changed in ubuntu-website-content: | |
status: | New → Confirmed |
importance: | Undecided → Low |
www.ubuntu.com avoids the same mistake, but only narrowly. From assets. ubuntu. com/sites/ guidelines/ css/latest/ ubuntu- styles. css>:
<http://
code,li,p,pre{ size:1em; bottom: .75em; height: 1.6; bottom: .75em
font-
margin-
line-
margin-
}
In the case of <code>, the margin declarations are no-ops, because <code> is an inline element, not a block element. The only effective declaration is the {line-height: 1.6}, and that probably doesn't do what its creator thought it would! "code," would best be removed from that selector as well.