Picking up where the Web Skills class left off, we'll review HTML tags, nesting, and attributes. We'll also review basic CSS selectors and properties.
Make sure you have all the required software installed before this class, as we’ll double check your settings and development environment. We’ll also learn to snoop our sites with Chrome’s Inspector.
In this section, we will do a review of HTML we learned in Web Skills.
Remember that most HTML tags have two parts:
<p>
</p>
The closing tag has a forward-slash before the end of the name.
It’s important that we understand attributes which are pieces of information that can go into tags.
Attributes like href=""
go inside the <a> tag to specify where a user will go when they click a link.
There are three attributes that can go in all HTML tags that pertains to CSS:
Later, when we get into video, you may see some attributes with no value assigned. These are boolean attributes, which means they either exist or they don’t, which determines whether they are true or false. If they are present, it is assumed they are true. One common place these are seen is in the <video> tag. You can optionally include player controls, or remove the attribute altogether, to have a chromeless video play.
In the above example, the preload, controls and loop attributes do not assign a value (there is no equals symbol). If they are present, then they set those properties of the video.
The data attribute will be important later when we do JavaScript. This attribute allows us to include some arbitrary data to HTML tags, which can be used by plugins or many other JavaScript utilities.
Data attributes always start with the word data and then end with a hyphen. The words that come after that depend on the plugin being used. There might be a plugin that wants the word “slideshow” as a data attribute. In your html tag, you might include: data-slideshow="true"
The data keyword here is slideshow, and the value you assign it is true.
In this example below, a plugin called Cycle has some properties you can assign:
There are some relatively new special HTML5 video tags that allow you to display video files right in the browser without any special players or other code.
<video width="800" height="600" poster="image.jpg" preload controls loop>
<source src="path/to/video.mp4" type="video/mp4" />
<source src="path/to/video.webm" type="video/webm" />
<img src="fallback.jpg" />
</video>
The video tags takes the following attributes:
The two <source> tags offer two more more options for video files to be loaded. This creates a fallback system in case the browser doesn’t support a particular video type. (Firefox doesn’t support H.264 mp4 files, for example.) We will use a conversion software to convert from mp4 to webm, which is supported by Internet Explorer and Firefox.
Note: Please see Page 214 in HTML & CSS book for more information.
A path is the location of files that pertain to your web page. We often list paths in attributes like href=""
or src=""
. How you write your path, particularly the characters you use to start the path, determine where the browser will look for the files.
Paths take the following forms:
These start with a protocol, like http:
or https:
. These will go out onto the web and fetch a web page somewhere based on the URL given. Everything after that is an absolute path.
Note: Please see Page 81–84 in HTML & CSS book for more information.