Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a semantic way to DEemphasize text with html & css?

The way I normally would do this in HTML(5) would be like this:

/* CSS For this example */
footer p {
font-size: 16px;
font-weight: normal;
}

footer strong {
font-weight: bolder;
}

<!-- HTML for this example -->
<footer>
  <p>Title <strong>- Name. 1234 N. Main St., Anytown, USA</strong></p>
</footer>

My problem with doing it this way, is that it seems that 90% of the text in the paragraph is given greater importance, which seems counter intuitive to me. It would seem to me to be more semantic to only wrap the text that is abnormal in the paragraph, which in this case is the lighter weight text and leave footer p {font-weight:bold}.

Is <small> the appropriate element here even though its not really for a legal disclaimer, etc.

like image 291
Miles Carmany Avatar asked Sep 15 '11 16:09

Miles Carmany


People also ask

Is h1 semantic?

In HTML, for example, the <h1> element is a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page."

What does em tag do in HTML?

The <em> tag is used to define emphasized text. The content inside is typically displayed in italic.

Which mark up element would you use for the text HTML?

p Element. The <p> tag stands for paragraph, which is the most common tag used to create lines of text inside an HTML document.

Is em a semantic tag?

<strong> and <em> are semantic - they specify that the enclosed text should be "strong" or "emphasised" in some way, usually bold and italic, but allow for the actual styling to be controlled via CSS. Hence these are preferred in modern web pages.


2 Answers

Yes, in your case <small> is appropriate element, although it does not "de-emphasize" text.

Lines from the current html specifications:

Note: Small print typically features disclaimers, caveats, legal restrictions, or copyrights. Small print is also sometimes used for attribution, or for satisfying licensing requirements.

Note: The small element does not "de-emphasize" or lower the importance of text emphasized by the em element or marked as important with the strong element. To mark text as not emphasized or important, simply do not mark it up with the em or strong elements respectively.

http://www.w3.org/TR/html5/text-level-semantics.html#the-small-element

like image 142
v42 Avatar answered Oct 19 '22 03:10

v42


The normal font color is black (#000). Adjusting the color, to a lighter version, will de-emphasize the text fragment.

Strong is a tag to emphasize text, so I'd suggest using <small> instead.

footer small {
    color: #999;
}

Result: http://jsfiddle.net/rzHgW/

like image 24
Rob W Avatar answered Oct 19 '22 05:10

Rob W