html Flashcards
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
Example
</p><p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Links
HTML links are defined with the <a> tag:</a>
</a><a>This is a link</a>
»>HTML links are defined with the a tag:
This is a link
HTML Images
HTML images are defined with the <img></img> tag.
The source file (src), alternative text (alt), width, and height are provided as attributes:
<img></img>
HTML Elements
The HTML element is everything from the start tag to the end tag:
Content goes here…
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
**The <br></br> tag defines a line break, and is an empty element without a closing tag:
Example
<p>This is a <br></br> paragraph with a line break.</p>
The src Attribute
The <img></img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed:
Example
<img></img>
The width and height Attributes
The <img></img> tag should also contain the width and height attributes, which specifies the width and height of the image (in pixels):
Example
<img></img>
The alt Attribute
The required alt attribute for the <img></img> tag specifies an alternate text for an image, if the image for some reason cannot be displayed. This can be due to slow connection, or an error in the src attribute, or if the user uses a screen reader.
Example
<img></img>
The style Attribute
The style attribute is used to add styles to an element, such as color, font, size, and more.
Example
<p>This is a red paragraph.</p>
The lang Attribute
You should always include the lang attribute inside the tag, to declare the language of the Web page. This is meant to assist search engines and browsers.
The following example specifies English as the language:
…
The title Attribute
The title attribute defines some extra information about an element.
The value of the title attribute will be displayed as a tooltip when you mouse over the element:
Example
<p>This is a paragraph.</p>
Summary
All HTML elements can have attributes
The href attribute of <a> specifies the URL of the page the link goes to
The src attribute of <img></img> specifies the path to the image to be displayed
The width and height attributes of <img></img> provide size information for images
The alt attribute of <img></img> provides an alternate text for an image
The style attribute is used to add styles to an element, such as color, font, size, and more
The lang attribute of the tag declares the language of the Web page
The title attribute defines some extra information about an element</a>
Bigger Headings
Each HTML heading has a default size. However, you can specify the size for any heading with the style attribute, using the CSS font-size property:
Example
<h1>Heading 1</h1>
HTML Horizontal Rules
The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.
The <hr> element is used to separate content (or define a change) in an HTML page:
Example <h1>This is heading 1</h1> <p>This is some text.</p> <hr> <h2>This is heading 2</h2> <p>This is some other text.</p> <hr>
Solution for Poem Problems - The HTML <pre> Element
</pre>
The HTML <pre> element defines preformatted text.
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:
Example
<pre>
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.
Oh, bring back my Bonnie to me.
</pre>
</pre></pre>
HTML Styles
The HTML style attribute is used to add styles to an element, such as color, font, size, and more
<p>I am normal</p>
<p>I am red</p>
<p>I am blue</p>
<p>I am big</p>
***Background Color
The CSS background-color property defines the background color for an HTML element.
Example
Set the background color for a page to powderblue:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
Hoặc:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
Text Alignment
The CSS text-align property defines the horizontal text alignment for an HTML element:
Example
<h1>Centered Heading</h1>
<p>Centered paragraph.</p>
Summary 2
Use the style attribute for styling HTML elements
Use background-color for background color
Use color for text colors
Use font-family for text fonts
Use font-size for text sizes
Use text-align for text alignmen
HTML Formatting Elements
Formatting elements were designed to display special types of text:
<b> - Bold text <strong> - Important text <i> - Italic text <em> - Emphasized text - Marked text <small> - Smaller text <del> - Deleted text <ins> - Inserted text <sub> - Subscript text <sup> - Superscript text
VD: <p><b>This text is bold.</b></p></sup></sub></ins></del></small></em></i></strong></b>
HTML <blockquote> for Quotations</blockquote>
The HTML <blockquote> element defines a section that is quoted from another source.
Browsers usually indent <blockquote> elements.
Example
<p>Here is a quote from WWF's website:</p>
<blockquote>
For 50 years, WWF has been protecting the future of nature.
</blockquote>
</blockquote></blockquote>
HTML for Short Quotations
The HTML tag defines a short quotation.
Browsers normally insert quotation marks around the quotation.
Example
<p>WWF's goal is to: Build a future where people live in harmony with nature.</p>
HTML <abbr> for Abbreviations</abbr>
The HTML <abbr> tag defines an abbreviation or an acronym, like “HTML”, “CSS”, “Mr.”, “Dr.”, “ASAP”, “ATM”.</abbr>
Marking abbreviations can give useful information to browsers, translation systems and search-engines.
Tip: Use the global title attribute to show the description for the abbreviation/acronym when you mouse over the element.
Example
<p>The <abbr>WHO</abbr> was founded in 1948.</p>
</abbr>
HTML <address> for Contact Information</address>
The HTML <address> tag defines the contact information for the author/owner of a document or an article.
The contact information can be an email address, URL, physical address, phone number, social media handle, etc.
The text in the <address> element usually renders in italic, and browsers will always add a line break before and after the <address> element.
Example <address> Written by John Doe.<br> Visit us at:<br> Example.com<br> Box 564, Disneyland<br> USA </address></address></address></address>
HTML <cite> for Work Title</cite>
The HTML <cite> tag defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.).</cite>
Note: A person’s name is not the title of a work.
The text in the <cite> element usually renders in italic.</cite>
Example
<p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p>
</cite></cite>
HTML for Bi-Directional Override
BDO stands for Bi-Directional Override.
The HTML tag is used to override the current text direction:
Example
This text will be written from right to left
HTML Quotation and Citation Elements
Tag Description
<abbr> Defines an abbreviation or acronym</abbr>
<address> Defines contact information for the author/owner of a document
Defines the text direction
<blockquote> Defines a section that is quoted from another source
<cite> Defines the title of a work
Defines a short inline quotation</cite></blockquote></address>
</abbr>