From 342d70ecdee87c6cdca4bf7ca15d143ff400019f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 29 Jun 2021 09:50:40 -0400 Subject: cleanup for publication --- html.html | 81 ++++++++++++++++++++++++--------------------------------------- 1 file changed, 31 insertions(+), 50 deletions(-) (limited to 'html.html') diff --git a/html.html b/html.html index 7ed32df..e12d8ac 100644 --- a/html.html +++ b/html.html @@ -49,7 +49,7 @@ Note how this HTML file appears as a webpage: - +
<!DOCTYPE html>
@@ -70,7 +70,7 @@ multiple lines.
 Observe if we add lines to the end of this file:
 

- +
<!DOCTYPE html>
@@ -116,7 +116,7 @@ Heading tags are for your page's title and section headings in the document:
 
 
 
-
+
<h1>This is a top-level heading.</h1>
@@ -149,69 +149,50 @@ If we use these heading tags, when we clear CSS, we can easily style all &
 to be the size and color and alignment we want.
 

-<<++>> -<<++>> -<<++>> -

A look at a decent template

+

Text formatting

-

- It's a good habit to include the same core things in every HTML page. - I have a template file that I use for this website that includes all the basics. - When I make a new page, I just copy the template and add the content. - Here is what the template looks like: -

-
<!DOCTYPE html>
-<html lang=en>
-    <head>
-        <title>Your page title</title>
-        <meta charset="utf-8"/>
-        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
-        <link rel='stylesheet' type='text/css' href='style.css'>
-        <meta name="viewport" content="width=device-width, initial-scale=1">
-        <link rel='alternate' type='application/rss+xml' title='Site Title RSS' href='/rss.xml'>
-    </head>
-<body>
-    <header><h1>Your page title</h1></header>
-
-    <nav></nav>
-
-    <main>
+

+HTML can also be used to do text formatting. +We can make bold, italic, underlined or struck through text with more HTML tags: +

- Put all your page content here in the <main> tag. + + + + + +
+
<p>This is <b>bold text</b>.</p>
 
-    </main>
+<p>This is <i>italic text</i>.</p>
 
-    <footer></footer>
-</body>
-</html>
+<p>This is <u>underlined</u>.</p> -

The -

+<p>This is <s>struck through</s>.</p> +
+ formatted text +
-

HTML can be broken...

+

Semantic Tags

- HTML is interpreted by browsers very liberally. - If you make mistakes in HTML, browsers will do their best to be forgiving and try to figure out what you meant. + While <b></b> and <i></i> + do exist, it's actually better not to use them directly in text.

- For example, paragraphs are formatted by the <p> tag and when the paragraph ends, - </p> should be included. - However, if you forget or neglect to include a </p> to close the tag, this isn't a big deal, as if your browser sees another <p> to start a new paragraph, it will consider the previous paragraphy closed and both paragraphs will be formatted correctly. - In fact, there are some people nowadays that only ever use the opening tag and never close them! + Try using <strong></strong> instead of <b></b> and <em></em> instead of <i></i>. + By default, they will look exactly the same. + You complain that they require more key presses, but it's thought to be a very bad idea to modify lower-level tags with CSS directly.

-

...but not always.

-

- That works fine with <p>, but for other tags like <b>, it won't work. - Your browser can't guess where you want the bolding to end, so if you fail to close a <b> with </b>, - the whole rest of your document will show up bold! + Note that some bold words on this site have different color for emphasis. + This is a setting set via CSS for all <strong> tags. + It would not be a good idea for us to use this for <b>, since there might be a non-colored situation we want to occasionally use it in.

- - Next: Text formatting in HTML + Next: Images and Links in HTML -- cgit v1.2.3