HTML_10_Layout

Layout

HTML has several semantic elements that define the different parts of a web page:

<header> - Defines a header for a document or a section

<nav> - Defines a set of navigation links

<section> - Defines a section in a document

<article> - Defines an independent, self-contained content

<aside> - Defines content aside from the content (like a sidebar)

<footer> - Defines a footer for a document or a section

<details> - Defines additional details that the user can open and close on demand

<summary> - Defines a heading for the <details> element

<main> - The <main> HTML element represents the dominant content of the <body> of a document. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application.

















ID attribute & class attribute

the id attribute, it is used to uniquely identify that element from other elements on the page. Its value should start with a letter or an underscore. id attribute is known as a global attribute because it can be used on any element.
a class attribute, sometimes, rather than uniquely identifying one element within a document, you will want a way to identify several elements as being different from the other elements on the page.

div & span

<div>
The <div> element allows you to group a set of elements together in one block-level box.

<span>
The <span> element acts like an inline equivalent of the <div> element. It is used to either:
1. Contain a section of text where there is no other suitable element to differentiate it from its surrounding text
2. Contain a number of inline elements The most common reason why people use <span> elements is so that they can control the appearance of the content of these elements using CSS.

Difference between id and class,  div and span

ID's are unique
Each element can have only one ID
Each page can have only one element with that ID
Classes are NOT unique
You can use the same class on multiple elements.
You can use multiple classes on the same element.
<div> tag is used to identify a blocklevel section/division of a document that has a line break both before and after it.
<span> tag is used to identify an inline section/division of a document.
Some elements will always appear to start on a new line in the browser window. These are known as block level elements. Examples of block elements are <h1>, <p>, <ul>, and <li>.
Some elements will always appear to continue on the same line as their neighbouring elements. These are known as inline elements. Examples of inline elements are <a>, <b>, <em>, and <img>.





Comments

Popular posts from this blog

HTML_1_Introduction

HTML_6_Media

HTML_7_Link