Here is a link back to Grumpy Cat: Home.
You can do the same thing by clicking on the picture below.
In writing, a section
var para = document.querySelector('p');
para.onclick = function() {
alert('Owww, stop poking me!');
}
You shouldn't use presentational elements like <font>
and <center>
.
In the above JavaScript example, para represents a paragraph element.
Select all the text with Ctrl/Cmd + A.
$ ping mozilla.org PING mozilla.org (63.245.215.20): 56 data bytes 64 bytes from 63.245.215.20: icmp_seq=0 ttl=40 time=158.233 ms
It's good to understand the overall meaning of all the HTML sectioning elements in detail — this is something you'll work on gradually as you start to get more experience with web development. You can find a lot of detail by reading our HTML element reference. For now, these are the main definitions that you should try to understand:
<main>
is for content unique to this page. Use <main>
only once per page, and put it directly inside <body>
. Ideally this shouldn't be nested within other elements.<article>
encloses a block of related content that makes sense on its own without the rest of the page (e.g., a single blog post).<section>
is similar to <article>
, but it is more for grouping together a single part of the page that constitutes one single piece of functionality (e.g., a mini map, or a set of article headlines and summaries), or a theme. It's considered best practice to begin each section with a heading; also note that you can break <article>
s up into different <section>
s, or <section>
s up into different <article>
s, depending on the context.<aside>
contains content that is not directly related to the main content but can provide additional information indirectly related to it (glossary entries, author biography, related links, etc.).<header>
represents a group of introductory content. If it is a child of <body>
it defines the global header of a webpage, but if it's a child of an <article>
or <section>
it defines a specific header for that section (try not to confuse this with titles and headings).<nav>
contains the main navigation functionality for the page. Secondary links, etc., would not go in the navigation.<footer>
represents a group of end content for a page.Each of the aforementioned elements can be clicked on to read the corresponding article in the "HTML element reference" section, providing more detail about each one.