Chapter 10
In This Chapter
Exploring basic CSS and defining CSS properties and values
Setting a new background color, creating a header, and customizing navigation menus
Changing fonts
Knowing HTML essentials
Chapter 8 shows how you can use free WordPress themes in your website. Many people are quite happy to use these themes without making any adjustments to them at all. I can’t tell you, however, how many times people have asked me whether they can customize a theme that they’ve found. The answer to their question is always, “Of course you can make changes on your own.”
The practice of changing a few elements of an existing WordPress theme is known as tweaking. Thousands of WordPress site owners tweak their existing themes on a regular basis. This chapter provides information on some of the most common tweaks you can make to your theme, such as changing the header image, changing the color of the background or the text links, and changing font styles — and these changes are pretty easy to make, too! You’ll be tweaking your own theme in no time flat.
Using a theme exactly as a theme author released it is great. If a new version is released that fixes a browser compatibility issue or adds features offered by a new version of WordPress, a quick theme upgrade is very easy to do.
However, chances are good that you’ll want to tinker with the design, add new features, or modify the theme structure. If you modify the theme, you won’t be able to upgrade to a newly released version without modifying the theme again.
If only you could upgrade customized versions of themes with new features when they’re released. Fortunately, child themes give you this best-of-both-worlds theme solution. Chapter 11 explores what child themes are, how to create a parent theme that’s child-theme ready, and how to get the most out of using child themes.
A Cascading Style Sheet (CSS) is a cascading sheet of style markup that controls the appearance of content on a website. Every single WordPress theme you use in your blog uses CSS. The CSS provides style and design flair to the template tags in your templates. (See Chapter 9 for information about WordPress template tags.) The CSS for your WordPress theme is pulled in through the Header template (header.php) and is named style.css.
In the Header template (header.php) of most WordPress themes, you find the following line of code, which pulls the CSS (style.css) into the page to provide the formatting of the elements of your blog:
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( ‘stylesheet_url’ ); ?>" />
Chapter 9 covers the commonly used parameters for the bloginfo(); template tag used in WordPress themes.
With CSS, you can provide style (such as size, color, and placement) to the display of elements on your blog (such as text links, header images, font size and colors, paragraph margins, and line spacing). CSS selectors contain names, properties, and values to define which HTML elements in the templates you will style with CSS. CSS selectors are used to declare (or select) which part of the markup the style applies to. Table 10-1 provides some examples of CSS selectors and their use.
Table 10-1 Basic CSS Selectors
CSS Selector |
Description |
HTML |
CSS |
body |
Sets the style for the overall body of the site, such as background color and default fonts. |
<body> |
body {background-color: white} The background color on all pages is white. |
p |
Defines how paragraphs are formatted. |
<p>This is a paragraph</p> |
p {color:black} The color of the fonts used in all paragraphs is black. |
h1 |
Provides bold headers for different sections of your site. |
<h1>This is a site title</h1> |
h1 {font-weight: bold;} A font surrounded by the <h1>..</h1> HTML tags is bold. |
a |
Defines how text links display in your site. |
|
a {color: red} All text links appear in red. |
You can find the stylesheet (style.css) for the default Twenty Fifteen theme on the Edit Themes page in your Dashboard (see Figure 10-1). Everything in it may look foreign to you right now, but I want to bring your attention to two items you see when you scroll down that template:
IDs and classes define styling properties for different sections of your WordPress theme. Table 10-2 shows examples of IDs and classes from the header.php template in the Twenty Fifteen WordPress theme. Armed with this information, you’ll know where to look in the stylesheet when you want to change the styling for a particular area of your theme.
Table 10-2 Connecting HTML with CSS Selectors
HTML |
CSS Selector |
Description |
<div id="page"> |
#page |
Styles the elements for the page ID in your template(s). |
<div class=".site-header"> |
.site-header |
Styles the elements for the site-header class in your template(s). |
<h1 class= "site-title"> |
.site-title |
Styles the elements for your site-title class in your template(s), but also follows rules for the h1 values set in the CSS. |
<div class= "search-toggle"> |
.search-toggle |
Styles the elements for your search-toggle class in your template(s). |
<div id= "content"> |
#content |
Styles the elements for the content ID in your template(s). |
CSS properties are assigned to the CSS selector name. You also need to provide values for the CSS properties to define the style elements for the particular CSS selector you’re working with.
In the default Twenty Fifteen WordPress theme, the markup on line 30 in the Header template (header.php) is <div class="site-branding">. This class, with the name site-header, provides styling for the site header.
In the default Twenty Fifteen WordPress theme stylesheet, the CSS defined for the site-header class is as follows:
.site-branding {
min-height: 2em;
padding-right: 60px;
position: relative;
}
The CSS selector is .site-branding, which has three properties:
Table 10-3 provides some examples of commonly used CSS properties and values.
Table 10-3 Common CSS Properties and Values
CSS Property |
CSS Value |
Examples |
background-color |
Defines the color of the background (such as red, black, or white). |
Markup: <div id="page"> CSS: #page {background-color: white} |
background |
Defines a background image. |
Markup: <header id="banner"> CSS: header#banner {background: url(images/header.jpg) no-repeat;} |
font-family * |
Defines the fonts used for the selector. |
Markup: <body> CSS: body { font-family: ‘Lucida Grande’, Verdana, Arial, Sans-Serif;} |
color |
Defines the color of the text. |
Markup: <h1>Website Title</h1> CSS: h1 {color: blue} |
font-size ** |
Defines the size of the font used for the text. |
Markup: <h1>Website Title</h1> CSS: h1 {font-size: 18px;} |
text-align |
Defines the alignment of the text (left, center, right, or justified). |
Markup: <div id="wrapper"> CSS: #wrapper {text-align: left;} |
* W3Schools has a good resource on the font-family property here: www.w3schools.com/cssref/pr_font_font-family.asp
** W3Schools has a good resource on the font-size property here: www.w3schools.com/cssref/pr_font_font-size.asp
In Chapter 9, I discuss the Header template (header.php) in detail. In this section, I show you how to tweak the background color in the default Twenty Fifteen theme. If you’re not using the default Twenty Fifteen theme, you can also use the <body> tag in a Header template to change the background color of your website.
The Twenty Fifteen WordPress theme is packaged with the option to change the background to a different color or use an image for your background. To use the nifty, built-in custom background feature to change the Twenty Fifteen background for your blog, follow these steps:
Click the Background link under the Appearance menu.
The Custom Background page loads in the Dashboard.
Click the Select Color to change the background color.
You can enter a hex color code in the text box provided shown in Figure 10-2.
If you don’t know what hex color code you want to use, click the Select Color link and click a color within the provided color picker (see Figure 10-2). The color selected in Figure 10-2 is #f1f1f1, which is gray.
A hexadecimal (or hex) code represents a certain color. Hex codes always start with a hash symbol (#) and have six letters and/or numbers to represent a particular color; for example, the code #f1f1f1 represents the color gray in hexadecimal code. I talk more about hexadecimal values in the following section, “Changing the background using CSS.”
Click Background Image to use an image file for the background or upload an image from your computer.
Click the Browse button under Background Image and select a file from your the existing WordPress Media Library, or click Upload Files to upload an image from your computer. Then click the Choose Image.
If you do not see the Background link under the Appearances menu in the Dashboard, that means that the theme you are using does not currently support custom backgrounds (note that the default theme, Twenty Fifteen, does). You can add support for the Custom Background feature to any theme with just a few lines of code.
Just follow these steps:
Browse to the Edit Themes page and click the Theme Functions (functions.php ) template.
The Theme Functions template opens in the text editor on the left side of the page.
Add the following line of code to the Theme Functions template somewhere after the line that says <?php :
add_theme_support( ‘custom-background' );
This line of code tells WordPress that your theme has added the Custom Background feature.
Click the Update File button.
The Theme Functions template is saved, along with your changes. The Background link now displays below the Appearance menu.
The <body> tag is simple HTML markup. Every theme has this tag, which defines the overall default content for each page of your website — the site’s body. In the Twenty Fifteen stylesheet (style.css), the background for the body is defined like this:
body {
background-color: #fff;
}
The background for the <body> tag uses a hexadecimal color code of #fff that gives the background a white color. You can use a color or an image (or both) to style the background of your website:
www.w3schools.com/HTML/html_colornames.asp
.You can also use a combination of colors and images in your backgrounds.
If you want to change the background color of your theme, follow these steps:
In the WordPress Dashboard, click the Editor link on the Appearance menu.
The Edit Themes page opens.
Click the Stylesheet template link.
The style.css template opens in the text editor on the left side of the Edit Themes page (refer to Figure 10-1).
Scroll down in the text editor until you find the CSS selector body.
If you’re tweaking the default theme, this section is what you’re looking for:
body:before {
background-color: #fff;
}
If you’re tweaking a different template, the CSS selector body will look similar.
Edit the background property’s values.
For example, in the default template, if you want to change the background color to black, you can use one of the following:
background-color: #000000;
or
background-color: black;
Click the Update File button in the bottom-left corner of the page.
Your changes are saved and applied to your theme.
Visit your site in your web browser.
The background color of your theme has changed.
Most themes have a header image that appears at the top of the page. This image is generated by a graphic defined either in the CSS value for the property that represents the header area, or through the use of a feature in WordPress called a custom header. In the WordPress default Twenty Fifteen theme, all the hard work’s been done for you. Including a custom header image on a blog that uses the Twenty Fifteen theme is pretty darn easy.
To upload a new header image, click the Header link in the Appearances menu in your Dashboard, and follow these steps:
Click the Add New Image button under the Header Image title.
Select the image from the WordPress Media Library, or upload an image from your computer and then click Open.
Click Select and Crop.
The Crop Image page appears, where you can crop the image and adjust which portion of the header image you would like displayed (see Figure 10-3).
Click the Crop Image button.
The Header Image page appears, and your new header image is now displayed.
View your website.
Your new header image appears at the top of your website.
In themes that do not have the custom header image feature, you can easily define a background image for the header image using CSS.
For purposes of this example, the HTML markup for the header in the template is this:
<header id="site-header"></div>
In the CSS (style.css) file, you can use a background image by defining it in the CSS properties for #site-header. Use this code:
#site-header {
background: url(/images/header-image.jpg) no-repeat;
max-width: 100%;
height: auto;
}
The background value indicates an image called header-image.jpg. For it to display on your site, you need to create the image and upload it to your web server under /wp-content/theme-name/images/.
A navigation menu is a listing of links displayed on your site. These links can be to pages, posts, or categories within your site, or they can be links to other sites. Either way, you can define navigation menus on your site through the built-in Custom Menu feature in WordPress.
It’s to your advantage to provide at least one navigation menu on your site so that readers can see everything your site has to offer. Providing visitors with a link — or several — to click keeps the point-and-click spirit of the web.
The Custom Menu feature is already built in to the default Twenty Fifteen WordPress theme, so you don’t have to worry about preparing your theme for it. However, if you’re using a different theme, adding support for the Menu feature to your theme is easy:
Click the Editor link under the Appearance menu. Then click the Theme Functions (functions.php) template.
The Theme Functions template opens in the text editor on the left side of the Edit Themes page.
add_theme_support( ‘nav-menus’ );
Click the Update File button to save the changes to the template.
This template tag tells WordPress that your theme can use the Custom Menu feature, and a Menus link now appears under the Appearance menu in the Dashboard.
Open the Header template (header.php).
Click the Header link on the Edit Themes page to open the Header template in the text editor on the left side of the Edit Themes page.
Add the following template tag by typing it on a new line in the Header template (header.php) somewhere after the <body> tag:
<?php wp_nav_menu(); ?>
This template tag is needed so that the menu you build using the Custom Menu feature will display at the top of your website. Table 10-4 details the different parameters you can use with the wp_nav_menu(); template tag to further customize the display to suit your needs.
Save the changes you’ve made to the Header template.
Click the Update File button at the bottom of the page.
Table 10-4 Common Tag Parameters for wp_nav_menu();
Parameter |
Information |
Default |
Tag |
id |
The unique ID of the menu (because you can create several menus, each has a unique ID number). |
Blank |
wp_nav_menu( array( ‘id’ => ‘1’ ) ); |
slug |
The menu name in slug form (for example, nav-menu). |
Blank |
wp_nav_menu( array( ‘slug’ => ‘nav-menu’ ) ); |
menu |
The menu name. |
Blank |
wp_nav_menu( array( ‘menu’ => ‘Nav Menu’ ) ); |
menu_class |
The CSS class used to style the menu list. |
Menu |
wp_nav_menu( array( ‘menu_class’ => ‘mymenu’ ) ); |
format |
The HTML markup used to style the list — either an unordered list (ul/li) or div class. |
div |
wp_nav_menu( array( ‘format’ => ‘ul’ ) ); |
fallback_cb |
The parameter that creates a fallback if a custom menu doesn’t exist. |
wp_page_menu (the default list of page links) |
wp_nav_menu( array( ‘ fallback_cb’ => ‘wp_page_menu’) ); |
before |
The text that displays before the link text. |
None |
wp_nav_menu( array( ‘before’ => ‘Click Here’ ) ); |
after |
The text that displays after the link text. |
None |
wp_nav_menu( array( ‘after’ => ‘»’ ) ); |
After you add the menu feature to your theme (or if you’re already using a theme that has the menu feature), building menus is easy — just follow these steps:
Click the Menus link in the Appearance menu in your Dashboard.
The Menus page opens in your WordPress Dashboard.
Type a name in the Menu Name box and click the Create Menu button.
The Menus page is reloaded with a message that tells you your new menu has been created.
Add links to your newly created menu.
WordPress gives you three ways to add links to the new menu you just created (the items in this list are shown in Figure 10-4):
https://www.google.com
). Next, type the name of the link that you want displayed in your menu in the Label text field (Google). Then click the Add to Menu button.Review your menu choices on the right side of the page.
When you add new menu items, the column on the right side of the Menus page populates with your menu choices.
Edit your menu choices, if needed.
Click the Edit link to the right of the menu link name to edit the information of each individual link in your new menu.
Save your menu before leaving the Menus page.
Be sure to click the Save Menu button under Menu Settings on the right side at the top of the Menus page. A message appears, confirming that the new menu has been saved.
The HTML markup for the menu is generated as an unordered list, by default, and looks like this in the sites source code:
<ul id="menu-main" class="menu">
<li id="menu-item-1" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1"><a href="/">Home</a></li>
<li id="menu-item-2" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2"><a href="http://localhost/wpdemo/blog/">Blog</a></li>
<li id="menu-item-3" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3"><a href="http://localhost/wpdemo/about/">About</a></li>
</ul>
Notice in the HTML markup that the first line defines CSS ID and class: <ul id="menu-main" class="menu">. The ID in that line reflects the name that you gave your menu. Because I gave my menu the name of “Main” when I created it in the Dashboard, the CSS ID is menu-main. If I had named it “Foo,” the ID would instead be menu-foo. This assignment of menu names in the CSS and HTML markup is why WordPress allows you to use CSS to create different styles and formats for your different menus.
When developing themes for yourself or others to use, you want to make sure that the CSS you define for the menus can do things like account for subpages by creating drop-down menu effects. You can do this several different ways, and Listing 10-1 gives you just one example of a block of CSS that you can use to create a nice style for your menu (this CSS example assumes that you have a menu named “Main”; therefore, the HTML and CSS markup indicate ‘menu-main’).
Listing 10-1: Sample CSS for Drop-Down Menu Navigation
#menu-main {
width: 960px;
font-family: Georgia, Times New Roman, Trebuchet MS;
font-size: 16px;
color: #FFFFFF;
margin: 0 auto 0;
clear: both;
overflow: hidden;
}
#menu-main ul {
width: 100%;
float: left;
list-style: none;
margin: 0;
padding: 0;
}
#menu-main li {
float: left;
list-style: none;
}
#menu-main li a {
color: #FFFFFF;
display: block;
font-size: 16px;
margin: 0;
padding: 12px 15px 12px 15px;
text-decoration: none;
position: relative;
}
#menu-main li a:hover,
#menu-main li a:active,
#menu-main .current_page_item a,
#menu-main .current-cat a,
#menu-main .current-menu-item {
color: #CCCCCC;
}
#menu-main li li a,
#menu-main li li a:link,
#menu-main li li a:visited {
background: #555555;
color: #FFFFFF;
width: 138px;
font-size: 12px;
margin: 0;
padding: 5px 10px 5px 10px;
border-left: 1px solid #FFFFFF;
border-right: 1px solid #FFFFFF;
border-bottom: 1px solid #FFFFFF;
position: relative;
}
#menu-main li li a:hover,
#menu-main li li a:active {
background: #333333;
color: #FFFFFF;
}
#menu-main li ul {
z-index: 9999;
position: absolute;
left: -999em;
height: auto;
width: 160px;
}
#menu-main li ul a {
width: 140px;
}
#menu-main li ul ul {
margin: -31px 0 0 159px;
}
#menu-main li:hover ul ul,
#menu-main li:hover ul ul {
left: -999em;
}
#menu-main li:hover ul,
#menu-main li li:hover ul,
#menu-main li li li:hover ul, {
left: auto;
}
#menu-main li:hover {
position: static;
}
You don’t have to use the wp_nav_menu(); template tag to display the menus on your site, because WordPress also provides you with Custom Menu widgets that you can add to your theme. You can therefore use widgets instead of template tags to display the navigation menus on your site. This feature is especially helpful if you have created multiple menus in and around your site in various different places.
Your first step is to register a special widget area for your theme to handle the Custom Menu widget display. To register this widget, open your theme’s functions.php file and add the following lines of code on a new line:
// ADD MENU WIDGET
if ( function_exists('register_sidebars') )
register_sidebar(array(‘name’=>‘Menu Widget’,));
These few lines of code create a new widget area called Menu on the Widgets page in your Dashboard. At this point, you can drag the Custom Menu widget into the Menu Widget area to indicate that you want to display a Custom Menu in that area. The Available Widgets area with the Menu Widget displayed is in Figure 10-5.
To add the widget area to your theme, head over to the Theme Editor (Appearance Editor) and open the header.php file; then add these lines of code in the area you want the Menu widget displayed; for example, near the site name:
<ul>
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Menu Widget’) ) : ?>
<?php endif; ?>
</ul>
These lines of code tell WordPress that you want information contained in the Menu widget area displayed on your site.
You can change the fonts in your theme for style or readability. I’ve seen typographic (or font) design experts use simple font variations to achieve amazing design results. You can use fonts to separate headlines from body text (or widget headlines and text from the main content) to be less distracting. Table 10-5 lists some examples of often-used font properties.
Table 10-5 Fonts
Font Properties |
Common Values |
CSS Examples |
font-family |
Georgia, Times, serif |
body {font-family: Georgia; serif;} |
font-size |
px, %, em |
body {font-size: 14px;} |
font-style |
Italic, underline |
body {font-style: italic;} |
font-weight |
Bold, bolder, normal |
body {font-weight: normal} |
The web is actually kind of picky about how it displays fonts, as well as what sort of fonts you can use in the font-family property. Not all fonts appear correctly on the web. To be safe, consider sticking to some commonly used font families that appear correctly in most browsers:
With more than 16 million different HTML color combinations available, you can find just the right color value for your project. After some time, you’ll memorize your favorite color codes. I find that knowing codes for different shades of gray helps me quickly add an extra design touch. For example, I often use the shades of gray listed in Table 10-6 for backgrounds, borders on design elements, and widget headers.
Table 10-6 My Favorite CSS Colors
Color |
Value |
White |
#FFFFFF |
Black |
#000000 |
Grays |
#CCCCCC |
#DDDDDD |
|
#333333 |
|
#E0E0E0 |
You can easily change the color of your font by changing the color property of the CSS selector you want to tweak. You can use hex codes to define the colors.
You can define the overall font color in your site by defining it in the body CSS selector like this:
body {
color: #333333;
}
To tweak the size of your font, change the font-size property of the CSS selector you want to change. Font sizes are generally determined by units of measurement, as in these examples:
In the default template CSS, the font size is defined in the <body> tag in pixels, like this:
font-size: 12px;
When you put all three elements (font family, color, and font size) together in the <body> tag, they style the font for the overall body of your site. Here’s how they work together in the <body> tag of the default template CSS:
body {
font-size: 12px;
font-family: Georgia, "Bitstream Charter", serif;
color: #666666;
}
When you want to change a font family in your CSS, open the stylesheet (style.css), search for property: font-family, change the values for that property, and save your changes.
In the default template CSS, the font is defined in the <body> tag, like this:
font-family: Georgia, "Bitstream Charter", serif;
Using CSS borders can add an interesting and unique flair to elements of your theme design. Table 10-7 illustrates common properties and CSS examples for borders in your theme design.
Table 10-7 Common Border Properties
Border Properties |
Common Values |
CSS Examples |
border-size |
px, em |
body {border-size: 1px;} |
border-style |
solid, dotted, dashed |
body {border-style: solid} |
border-color |
Hexadecimal values |
body {border-color: #CCCCCC} |
The time may come when you want to explore customizing your theme further. Here are some recommended resources:
http://codex.wordpress.org
): Official WordPress documentationwww.//w3schools.com
): A free and comprehensive online HTML and CSS referencewww.//webdesign.com
): A premium library of WordPress video tutorials and trainingwww.smashingmagazine.com
): Gives numerous tips and tricks for customizing a WordPress themeHTML can help you customize and organize your theme. To understand how HTML and CSS work together, think of it this way: If a website were a building, HTML would be the structure (the studs and foundation) and CSS would be the paint.
HTML contains the elements that CSS provides the styles for. All you have to do to apply a CSS style is use the right HTML element. For this example, I break down a basic block of HTML:
<body>
<div id="content">
<header>
<h1>Headline Goes Here</h1>
</header>
<section>
<article>
<p>This is a sample sentence of body text. <blockquote>The journey of a thousand miles
starts with the first step.</blockquote> I'm going to continue on this sentence and end it
here. </p>
<p>Click <a href="http://lisasabin-wilson.com">here</a> to visit my website.</p>
</article>
</section>
</div>
</body>
All HTML elements must have opening and closing tags. Opening tags are contained in less-than (<) and greater-than (>) symbols. Closing tags are the same, except that they are preceded by a forward-slash ( / ).
For example:
<h1>Headline Goes Here</h1>
Note that the HTML elements must be properly nested. In line eight of the preceding example, a paragraph tag is opened (<p>). Later in that line, a block quote is opened (<blockquote>
) and is nesting inside the paragraph tag. When editing this line, you could not end the paragraph (</p>) before you end the block quote (</blockquote>). Nested elements must close before the elements they are nested within close.
Finally, proper tabbing, or indenting, is important when writing HTML, mainly for readability so that you can quickly scan through code to find what you’re looking for. A good rule to follow is that if you didn’t close a tag in the line above, indent one tab over. This practice allows you to see where each element begins and ends. It can also be very helpful when diagnosing problems.
You will use several very basic HTML markup practices over and over in web design and putting together websites. Earlier in this chapter, I discuss how to combine CSS styling with HTML markup to create different display styles (borders, fonts, and so on).
The following sections provide you with commonly used HTML markup samples that you will find helpful as a reference for using HTML in your website code.
You will probably want to insert an image into your website, whether it is within the body of a post or page, in the sidebar by using a widget, or within the template code itself. The HTML markup to insert an image looks like this:
<img src="/path/to/image-file.jpg" alt="Image File Name" />
I break down this code for you in easy snippets to help you understand what’s at work here:
You will probably want to insert a link within the body of a website — commonly referred to as a hyperlink, which is a line of text that is anchored to a web address (URL) so that clicking the text takes a visitor to another website or page that appears in the browser window.
The HTML markup to insert a hyperlink looks like this:
<a href="http://wiley.com">John Wiley & Sons, Inc. </a>
To break down that markup, here is a simple explanation:
http://wiley.com
": This is the web address, or URL, that you intend the text to be anchored to. It needs to be surrounded by quotation marks, which define it as the intended anchor, or address.Commonly, designers use URLs, or web addresses, to link words to other websites or pages; however, you can also provide hyperlinks to files such as .pdf (Adobe Acrobat), .doc (Microsoft Word), or any other file type.
Say you need to provide a clean-looking format for lists of information that you publish on your website. With HTML markup, you can easily provide lists that are formatted differently, depending on your needs.
Ordered lists are numbered sequentially. An example is a step-by-step list of things to do, like this:
Ordered lists are easy to create in a program such as Microsoft Word, or even in the WordPress post editor because you can use the WYSIWYG editor to format the list for you. However, if you want to code an ordered list using HTML, the experience is a little different. My previous step list sample looks like this when using HTML markup:
<ol>
<li>Write my book chapters.</li>
<li>Submit my book chapters to my publisher.</li>
<li>Panic a little when book is released to the public.</li>
<li>Breathe sigh of relief when public reviews are overwhelmingly positive!</li>
</ol>
The beginning <ol> tells your web browser to display this list as an ordered list, meaning that it will be ordered with numbers starting with the number 1. The entire list ends with the </ol> HTML tag, which tells your web browser that the ordered list is now complete.
Between the <ol> and </ol> are list items designated as such by the HTML markup <li>. Each list item starts with <li> and ends with </li>, which tells the web browser to display the line of text as one list item.
Unordered lists are very similar to ordered lists, except that instead of using numbers, they use bullet points to display the list, like this:
The HTML markup for an unordered list is just like the ordered list, except that instead of using the <ol> tag, it uses the <ul> tag (UL = unordered list):
<ul>
<li>Write my book chapters.</li>
<li>Submit my book chapters to my publisher.</li>
<li>Panic a little when book is released to the public.</li>
<li>Breathe sigh of relief when public reviews are overwhelmingly positive!</li>
</ul>
Note that both the ordered and unordered lists use the list item tags, <li> and </li>, and the only difference is in the first opening and last closing tags:
13.59.136.170