Block elements vs inline elements n Block elements
Block elements vs. inline elements n Block elements: – Occupy full width of parent element – Create a new line before and after n Inline elements: – Occupy only the amount of space their content requires – Do not create new lines – Also called “phrase elements” or “text-level elements”
The <b> element n Stands for “bold” n Used to highlight words or phrases without imparting emphasis or importance n For example: <p>Our specials this week are <b>Morning Blend</b> and <b>Outback Blend</b>, only <b>$4. 99</b> per pound. </p>
The <i> element n Stands for “italic” n Used to distinguish such things as terms and idioms, words in another language, or titles of works of art or literature n For example: <p> <i>Of Mice and Men</i> is her favorite novel. </p>
The <em> element n Stands for “emphasis” n Used to denote emphasis for a word or phrase n Many screen readers will speak with emphasis when text is inside an <em> element
The <strong> element n Used to mark important text n For example: <p> If you want to attend the conference, please note that <strong>registration ends on October 15, 2013. </strong> </p>
The <mark> element n Used to highlight content that is relevant in a particular context or for temporary reference n Typically output because of a user’s activity in an application (for example, search results are highlighted) n Should not be used to imply emphasis or importance
The <cite> element n Denotes a citation or reference to another source n Should contain only the title of a work or publication, not the author name or other related information n For example: <p>The following report from <cite>Investor's Monthly</cite> suggests that the market will rebound this year. </p>
The <dfn> element n Indicates a defining instance of a term, when a word is defined once in a document and then used elsewhere n For example: <p><dfn>Onomatopoeia</dfn> is a word that sounds like itself, for example, "thud" or "hiss. "</p>
Commonly used character entities Symbol Entity Description ® ® Registered symbol ™ ™ Trademark symbol © © Copyright symbol Non-breaking space ¼ &frac 14; One-quarter fraction ½ &frac 12; One-half fraction ¾ &frac 34; Three-quarters fraction
Global attributes n Attributes that can be applied to any HTML element n Examples: lang, class, id
The lang attribute n Used to specify primary language for document, or language of specific element n Helps search engines determine relevance n Helps alternative devices like screen readers identify changes in natural language n For example: <p>Thanks for your order. <i lang="fr">Bon appétit!</i> </p>
The id attribute n Serves as unique identifier for element on page n Typically used to uniquely identify major page sections: <section id="main. Content"> Other elements and content. . . </section> n ID name should describe the element’s content or role in overall structure or design
The class attribute n Use it to classify elements. For example: – For the <p> element, create a class named credit to contain author names – Semantically distinguishes the credit paragraph from other paragraphs n Classes are not unique to a page – A class name can be shared among multiple elements in a document n Choose class names that describe the role the element plays in the structure or design
Example of the class attribute <p> <strong class="warning">Do not click the Back button while your order is processing. </strong> </p>
The <blockquote> element n Defines block-level quotation n Use cite attribute to provide source of quote n For example: <blockquote cite= "http: //en. wikipedia. org/wiki/HTML 5"> "HTML 5 is a language for structuring and presenting content for the World Wide Web, a core technology of the Internet. " </blockquote>
The <q> element n Defines inline quotation n Use cite attribute to provide valid URL for source n For example: <p>HTML 5 <q cite= "http: //en. wikipedia. org/wiki/HTML 5"> extends, improves, and rationalizes the markup available for documents</q> on the Web. </p>
The <abbr> element n Defines abbreviations and acronyms n Use title attribute to provide full version of abbreviation n For example: <p> <abbr title="National Aeronautics and Space Administration">NASA</abbr> engineers cheered when they received a response from their Mars rover, named Spirit. </p>
- Slides: 17