1 / 10

Semantic Formatting Elements

Semantic Formatting Elements. The <mark> element.

tgarcia
Download Presentation

Semantic Formatting Elements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Semantic Formatting Elements

  2. The <mark> element • The official specification for <mark> is that it "indicates a highlight that was not originally present but which has been added to bring the reader's attention to a part of the text that might not have been considered important by the original author, but which is now under previously unexpected scrutiny." • The definition goes on to say that <mark> "indicates a part of the document that has been highlighted due to its likely relevance to the user's current activity." • A familiar example is when a user performs a keyword search and the results page has the searched term highlighted. Another might be highlighting a portion of an original text that has taken on new importance.

  3. Example of <mark> • In this example, words of a poem are highlighted to indicate their unusual frequency: <p>8 out of 46 words in this poem are the same word:</p> <p>This is the man all tattered and torn,<br> <mark>That</mark> kissed the maiden all forlorn,<br> <mark>That</mark> milked the cow with the crumpled horn,<br> <mark>That</mark> tossed the dog,<br> <mark>That</mark> worried the cat,<br> <mark>That</mark> killed the rat,<br> <mark>That</mark> ate the malt<br> <mark>That</mark> lay in the house <mark>that</mark> Jack built.</p> If we want to emphasize something we've written on our own page, there is usually a better option than using <mark>. Let's take a look at these other options now.

  4. XHTML Formatting Elements Let's review the formatting elements as they were used in XHTML: HTML5 includes each of these four elements but has redefined their usage. Let's cover them one at a time. <em> : Meaning "emphasis", this tag was used in XHTML for emphasized text, which generally rendered in italics. <strong> : In XHTML, this was used to make text "stronger", which normally bolded the characters. <i> : A holdover from earlier versions of HTML, this tag converted text to italics. XHTML discouraged its use, in favor of <em>. <b> : Another holdover from HTML, this tag bolded text. It was also discouraged in XHTML, in favor of <strong>.

  5. Using <em> in HTML5 • The <em> element is not intended as a generic way to italicize text. • Instead, it is used to change the inflection of the affected text, which in turn changes the meaning of the sentence. • Consider these examples: <p>We have to leave now.</p> <p>We have to leave <em>now</em>.</p> <p>There will be a history test on Friday.</p> <p>There <em>will</em> be a history text on Friday.</p> We have to leave now. We have to leave now. There will be a history test on Friday. There will be a history text on Friday. By adding the inflection to a word or phrase, the sentence meaning is altered. In the second sentence, we have to leave right now, urgently. In the final sentence, it was thought that there would be no test, but now it's discovered that there will in fact be one.

  6. Using <strong> in HTML5 • The <strong> element indicates semantic importance. It draws the reader's attention to an important portion of text. • The existence of <strong> does not change the overall meaning of the sentence, however. <p>Warning: Ice is not safe to walk on.</p> <p><strong>Warning:</strong> Ice is not safe to walk on.</p> <p>The meeting is at 5:00pm on Saturday.</p> <p>The meeting is at <strong>5:00pm on Saturday</strong>.</p> Warning: Ice is not safe to walk on. Warning: Ice is not safe to walk on. The meeting is at 5:00pm on Saturday. The meeting is at 5:00pm on Saturday. The <strong> element is a simple way for us to draw attention to something important on our page. Notice that if we do not bold the text, the meaning of the sentence remains the same.

  7. Using <i> in HTML5 • The <i> element is used when text needs to be italicized but does not have the emphasis and meaning alteration that <em> entails. • Examples include highly technical terms, words or phrases in foreign languages, thoughts, or the names of ships. <p>Sadly, the Tasmanian Tiger - <i>Thylacinus cynocephalus</i> - is now extinct.</p> <p>Hot dogs and hamburgers are not exactly <i lang="fr">haute cuisine</i>.</p> <p><i>I can't believe I'm saying this...</i> I'd love to go!</p> <p>I bet Ishmael wishes he had never been on <i>Pequod</i>.</p> Sadly, the Tasmanian Tiger - Thylacinus cynocephalus - is now extinct. Hot dogs and hamburgers are not exactly haute cuisine. I can't believe I'm saying this... I'd love to go! I bet Ishmael wishes he had never been on Pequod. Note that we can add a lang="xx" attribute for foreign words and phrases. This will further assist search engines and screen readers to understand our content.

  8. Using <b> in HTML5 • The <b> element is used to bold text that does not have any additional semantic importance. • Common examples include product names and study keywords, but <b> can also be used whenever we need to bold text for generic purposes. <p><b>Coca-Cola</b> and <b>Cinnamon Toast Crunch</b> are poor dietary choices.</p> <p>Remember that <b>rods</b> and <b>cones</b> play different roles to produce vision in the eye.</p> <p>Here is what bold text looks like in this font: <b>Bolded text</b></p> Coca-Cola and Cinnamon Toast Crunch are poor dietary choices. Remember that rods and cones play different roles to produce vision in the eye. Here is what bold text looks like in this font: Bolded text A good policy is to use <b> and <i> only when the semantic elements - <em>, <strong>, and <mark> - are not appropriate. Bolding product names and keywords is not mandatory. It's purely optional and up to the creator of the web page to decide.

  9. Change to the <hr> Element • In HTML, the <hr> element drew a horizontal rule across the page. • HTML5 tweaks this element by adding a semantic meaning, now defining it as a "paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book." ...but unfortunately there was no one there to greet him at the station.</p> <hr> <p>The following morning was greeted with a light mist that made it darker than... In practice, the <hr> element is a bit of a dinosaur to modern web designers, who prefer to use CSS styling and images for graphical and presentational components on their pages.

  10. Change to the <s> Element • In older versions of HTML, the <s> element drew a horizontal line (strike) through text. HTML 4.01 retired this element as obsolete. • HTML5 has brought the element back from the dead, but with a new, more specific definition: "The <s> element represents contents that are no longer accurate or relevant." <p>The world record for the 100 meter dash is <s>Asafa Powell at 9.74 seconds</s> Usain Bolt at 9.58 seconds.</p> A common real world use for the <s> element is to strike through an older price and then to display the new, lower price to demonstrate savings to the reader.

More Related