Using HTML Tags Flashcards
Declare the document as HTML (not a tag but looks like one)
<!DOCTYPE html>
All HTML documents must start with a declaration. The declaration is not an HTML tag. It is an “information” to the browser about what document type to expect. So it doesn’t need an closing tag. The ! and uppercase DOCTYPE is important, especially for older browsers. The html is not case sensitive.
Set the headings of an HTML page to give SEO something to pay attention to https://medium.com/swlh/html-heading-tags-best-practices-78a85f63df47
<h1> </h1> … <h6></h6>
What are 4 rules for using HTML heading numbers?
Don’t use h1,h2,h3 because you like the size of the font. Use CSS to change the size of the font.
Every page should only have one h1, the main subject of the content.
Higher numbers are subsections
Don’t jump from h2 to h4 as a subheading. This can confused screen readers. Go from h2 to h3.
Define a paragraph in HTML
<p></p>
Everything with the tags is ONE paragraph.
It does some text editing. Browsers automatically add a single blank line before and after each element. They also seem to remove extra spaces. (resetting CSS style sheets does not prevent this)
Ex:
<p>
Ipsom etc.
Ipsom e e e
etc.
</p>
Will be structured like this: “Ipsom etc. Ipsom e e e etc.”
Add comments in HTML code
<!– Comment here –>
Help SEO and search engines find the main content on your page
<main> </main>
<main> doesn’t affect the DOM’s concept of the structure of the page. It’s strictly informative.
What are 3 rules for the <main> element?
- The content inside the element should be unique to the document. It should not contain any content that is repeated across documents such as sidebars, navigation links, copyright information, site logos, and search forms
- There must not be more than one element in a document.
- The element must NOT be a descendant of other elements that give alternative semantic meaning , , , , or element.
Add an image
Have a backup in case that image fails
When do you use a backup?
If you don’t need an alt, what should you code?
<img src=”pic_trulli.jpg(url or file path)” alt=”Italian Trulli”>
img - self closing image element
src - for the image location source
alt - alt text
Use a backup when the image is a button or otherwise has important information for the functioning of the page. If it’s just aesthetic you don’t need alt. If the page already describes its absence, don’t use the tag.
If not needed, have it go to an empty string: alt=””
Create a link to external web page or another location
<a href=”http:\website.com”> text </a>
Describe the broad attributes of the anchor tag
There’s the link element HREF=”link”
And the text/image that will link to that link within the opening and closing a tags
Create an internal link to another section of the page. For example a “Jump to bottom” link
The link:
(needs a #)
<a href=”#contacts-header”>Contacts</a>
The Destination:
(should not have a #)
<h2 id=”contacts-header”>Contacts</h2>
Make an anchor tag link open in another tab
target=”_blank”
<a href=”link” target=”_blank”> - works with internal links to sections on the page <a href=”link”> - leave blank to open in same tab
Create a dead link. A link that just links to the current page
<a href=”#”>
make an image a link to something
Put the image inside the anchor element
<a href=”http://website.com”> img src=”https://www.bit.ly/fcc-relaxing-cat”> </a>
Describe the broad attributes of HTML lists
Ordered lists have are set with <ol>. Because they have different symbols for each, the type of symbol is defined with ype=”1”, a, A, i, or I.
Unordered lists are set with <ul>. They have the same symbol for each. The style is defined with CSS: style=”list-style-type:circle” or square or disc.