{"id":4016,"date":"2014-11-11T20:29:07","date_gmt":"2014-11-11T20:29:07","guid":{"rendered":"http:\/\/www.crimsondesigns.com\/blog\/?p=4016"},"modified":"2025-03-05T18:53:06","modified_gmt":"2025-03-05T18:53:06","slug":"smooth-strides-from-css-to-css3","status":"publish","type":"post","link":"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/","title":{"rendered":"Smooth Strides from CSS to CSS3"},"content":{"rendered":"<h3>Years ago HTML stood alone. Then along came CSS.<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-4057 size-full\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-to-css3.jpg\" alt=\"smooth strides from css to css3\" width=\"300\" height=\"414\" srcset=\"https:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-to-css3.jpg 300w, https:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-to-css3-217x300.jpg 217w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>In this beginner CSS tutorial, we&#8217;ll start slow with simple explanations of HTML and CSS, then we&#8217;ll push forward into CSS3, the latest version of CSS, and explain a few things about HTML5&#8217;s wonderful sidekick.<\/p>\n<p>This is a Companion Tutorial to &#8220;<a href=\"http:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-html-to-html5\/\">Smooth Strides from HTML to HTML5<\/a>&#8221; where we explored the basic structure of HTML and its newest version: HTML5. We used <strong>Speed Skating<\/strong> as a web page example in our first tutorial. Here we&#8217;ll switch to Figure Skating in our discussion, just for fun.<\/p>\n<h4>What&#8217;s the difference between HTML and CSS?<\/h4>\n<p><!--more--><\/p>\n<ul>\n<li><strong>HTML is a markup language.<\/strong> A markup language is not a programming language. A markup language uses markup tags to describe web pages. The pieces of HTML are marked using &#8220;HTML tags&#8221; which appear inside angle brackets &lt; &gt;. HTML allows you to put text, images, videos, forms and other pieces of content together into a web page.<\/li>\n<li><strong>CSS is a style sheet language.<\/strong> CSS stands for Cascading Style Sheets.\u00a0 A style sheet has rules that apply to an HTML document. CSS defines how HTML elements need to be displayed in a web page. Page layout, font size, font color, image positioning and more are determined by CSS.<\/li>\n<\/ul>\n<h3>In CSS, the syntax is different than HTML.<\/h3>\n<p><span class=\"special\">There are no angle brackets &lt; &gt; here. Instead, we use curly braces { }.<\/span><\/p>\n<h3>HTML, CSS and Web Browsers<\/h3>\n<p>Simply put, HTML tells the web browser the content to present while CSS tells the web browser how to present it.<\/p>\n<ul>\n<li>HTML gives instructions to web browsers, saying things like &#8220;this is a paragraph.&#8221;<\/li>\n<li>CSS gives instructions to web browsers, saying things like &#8220;this paragraph should be centered.&#8221;<\/li>\n<\/ul>\n<p><strong>Example CSS: p {text-align: center; font-color: blue;}<\/strong><\/p>\n<p>Web browsers interpret those instructions from a CSS style sheet.<\/p>\n<h4>Let&#8217;s take a closer look at CSS.<\/h4>\n<p><strong>h1 {color: green;}<\/strong><\/p>\n<p>What you see above is a simple CSS rule that sets the color of all first-level headings (h1).<\/p>\n<h3>Anatomy of a Rule<\/h3>\n<p>CSS has <strong>selectors<\/strong> and <strong>declarations.<\/strong> The selector specifies what elements (in the related HTML document) are affected by the declaration. A declaration contains properties and values.<\/p>\n<p><a href=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-rule.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4022 size-full\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-rule.gif\" alt=\"CSS rule with declaration block\" width=\"500\" height=\"130\" \/><\/a><\/p>\n<p><strong>selector {property: value}<\/strong><\/p>\n<p>\u2022 Selector &#8211; the part before the left curly brace<br \/>\n\u2022 Declaration &#8211; the part within the curly braces.<\/p>\n<p><strong>h1 {color: green;}<\/strong><\/p>\n<p>The property is color. The value here is green.<\/p>\n<p>In the example above, the selector is <strong>h1<\/strong> and the declaration is <strong>&#8220;color:\u00a0green.&#8221;<\/strong> All h1 elements in the related HTML document will be turned green.<\/p>\n<p>In Part Two, we will discuss how to apply CSS to HTML.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Intro<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/2\/\">Part Two &#8211; How do we apply CSS to HTML?<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/3\/\">Part Three &#8211; The CSS Order of Precedence<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/4\/\">Part Four &#8211; CSS3 Helps Old Web Browsers Understand HTML5<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/5\/\">Part Five &#8211; 3 New Popular Properties in CSS3<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/6\/\">Part Six -Creating a Simple HTML5 Web Page<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/7\/\">Part Seven &#8211; Tutorial Review<\/a><\/li>\n<\/ul>\n<p><!--nextpage--><\/p>\n<h3>Part Two: How do we apply CSS to HTML?<\/h3>\n<p>There are three ways you can apply CSS to an HTML document. The recommended method is to link to an\u00a0<strong>external style sheet.<\/strong> This technique can save you a lot of work. If for example, you would like to change the background color of 10 pages in a website, a linked style sheet can save you from having to manually change all 10 web pages, one by one. Using CSS, the change can be made in a few seconds.<\/p>\n<p><strong>&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;style.css&#8221;&gt;<\/strong><\/p>\n<p><strong>NOTE:<\/strong> You can link to more than one style sheet in an HTML document.<\/p>\n<p class=\"centerAlign\"><a href=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-style-sheet.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4024 size-full\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-style-sheet.gif\" alt=\"A CSS Style Sheet has rules\" width=\"550\" height=\"242\" \/><\/a><\/p>\n<h3><strong>Let&#8217;s Tidy Up our Style Sheet by Grouping<\/strong><\/h3>\n<p>We can group Selectors together and Rules together.<\/p>\n<p>Consider these three rules:<\/p>\n<p><strong>h1 {color: green;}<\/strong><br \/>\n<strong> h2 {color: green;}<\/strong><br \/>\n<strong> h3 {color: green;}<\/strong><\/p>\n<p>All three rules have the same declaration &#8211; they set the <strong>h1<\/strong> in the related HTML document to be <strong>green.<\/strong> Since all three declarations are identical, we can group the selectors into a list (separated by commas) and only write the declaration once:<\/p>\n<p><strong>h1, h2, h3 {color: green;}<\/strong><\/p>\n<p>A selector may have more than one declaration. For example, we could write a style sheet with these two rules:<\/p>\n<p><strong>h1 {color: green;}<\/strong><br \/>\n<strong> h1 {text-align: center;}<\/strong><\/p>\n<p>Or we can tidy up the style sheet by grouping the declarations that relate to the same selector into a list (separated by semicolons)<\/p>\n<p><strong>h1 {color: green; text-align: center;}<\/strong><\/p>\n<p>Next we will look at the CSS Order of Precedence. This is a simple subject and of great importance, because without understanding it, CSS can be frustrating.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Intro<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/2\/\">Part Two &#8211; How do we apply CSS to HTML?<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/3\/\">Part Three &#8211; The CSS Order of Precedence<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/4\/\">Part Four &#8211; CSS3 Helps Old Web Browsers Understand HTML5<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/5\/\">Part Five &#8211; 3 New Popular Properties in CSS3<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/6\/\">Part Six -Creating a Simple HTML5 Web Page<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/7\/\">Part Seven &#8211; Tutorial Review<\/a><\/li>\n<\/ul>\n<p><!--nextpage-->[section_title title=Part Three &#8211; The CSS Order of Precedence]<\/p>\n<h3>Part Three: The CSS Order of Precedence<\/h3>\n<p>Sometimes, CSS can be frustrating when you make a rule in your CSS document and the change is not what you expect when you see the linked web page in a browser. By understanding a little bit about the CSS Order of Precedence, you will have fewer moments of frustration.<\/p>\n<p><strong>Helpful Hint #1:<\/strong> If you&#8217;re placing two rules on one element, using the same class selector, and both rules are in the same style sheet, the rule that is further down will override the rule that is higher up in the style sheet.<\/p>\n<p>For example:<\/p>\n<p><strong>.favorite {color: red;}<\/strong><br \/>\n<strong> .favorite {color: black;}<\/strong><\/p>\n<p>The color will be black.<\/p>\n<p>You may think that you will never do this when you write your CSS rules, but the day may come when you go back to a style sheet that you started a year earlier. You add a new rule, hoping to change something in your web page to RED, but then nothing happens. You go back and look at your rule. It is coded perfectly. You look at your web page in the browser again. You refresh your web browser 3 times. Still&#8230; nothing changes. Finally, you examine your style sheet, rule by rule. You discover the same rule listed twice (with different values in the declaration).<\/p>\n<p><strong>Helpful Hint #2:\u00a0<\/strong> It&#8217;s also useful to note that if a link to an external style sheets is placed underneath a link to another style sheet, the styles in the lowest style sheet override those in the higher style sheet.<\/p>\n<p><strong>&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;style.css&#8221;&gt;<\/strong><br \/>\n<strong> &lt;link rel=&#8221;stylesheet&#8221; href=&#8221;layout.css&#8221;&gt;<\/strong><\/p>\n<p>We discussed how to link to external style sheets in our related tutorial: <strong>Smooth Strides from HTML to HTML5.<\/strong><\/p>\n<p><a href=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-order-of-precedence.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-4035 size-full\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/css-order-of-precedence.gif\" alt=\"CSS Order of Precedence\" width=\"326\" height=\"438\" \/><\/a><strong>Helpful Hint #3:<\/strong> Different selectors naturally override others.<\/p>\n<p>Here is the order in which this takes place:<\/p>\n<ol>\n<li><strong>The ID selector<\/strong><\/li>\n<li><strong>The attribute selector<\/strong><\/li>\n<li><strong>The class selector<\/strong><\/li>\n<li><strong>The child selector<\/strong><\/li>\n<li><strong>The adjacent sibling selector<\/strong><\/li>\n<li><strong>The descendant selector<\/strong><\/li>\n<li><strong>The type selector<\/strong><\/li>\n<\/ol>\n<p>The ID selector overrides all the other selectors. It is the most important. So if your web page is not doing what you think it should, consider the selectors you are using, the order in which you are using them in and the style sheet where they are placed.<\/p>\n<h4>Using IDs and Classes<\/h4>\n<p>In our related tutorial, we mentioned a tag &lt;div id=&#8221;wrapper&#8221;&gt;.<\/p>\n<p>We can style that tag by using this code in our CSS style sheet:<\/p>\n<p><strong>#wrapper {text-align: center;}<\/strong><\/p>\n<p>The (#) sign refers to an ID tag. It is specific. There can only be one ID of <strong>#wrapper<\/strong> in a web page.<\/p>\n<p>We also mentioned a tag &lt;span class=&#8221;special&#8221;&gt;. We can style that tag by using this code in our CSS style sheet.<\/p>\n<p><strong>. special {color: red;}<\/strong><\/p>\n<p>The (.) sign refers to a CLASS tag. It is not that specific and can be overridden with an ID selector. You can write &lt;span class=&#8221;special&#8221;&gt; in your web page as many times as you like.<\/p>\n<p>Learn more about <a href=\"http:\/\/www.corelangs.com\/css\/basics\/id-selectors.html\" target=\"_blank\" rel=\"noopener noreferrer\">ID and Class Selectors<\/a>.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Intro<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/2\/\">Part Two &#8211; How do we apply CSS to HTML?<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/3\/\">Part Three &#8211; The CSS Order of Precedence<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/4\/\">Part Four &#8211; CSS3 Helps Old Web Browsers Understand HTML5<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/5\/\">Part Five &#8211; 3 New Popular Properties in CSS3<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/6\/\">Part Six -Creating a Simple HTML5 Web Page<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/7\/\">Part Seven &#8211; Tutorial Review<\/a><\/li>\n<\/ul>\n<p><!--nextpage--><\/p>\n<h3>Part Four: CSS3 Helps Old Web Browsers Understand HTML5<\/h3>\n<p>This is a Companion Tutorial to &#8220;<a href=\"http:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-html-to-html5\/\">Smooth Strides from HTML to HTML5<\/a>&#8221; where we mentioned some of HTML5&#8217;s new elements. But we also discovered that there is a problem with old web browsers and their understanding of these new elements. Basically, they have no clue what they are.<\/p>\n<p>But we can get them to cooperate with our progressive efforts by adding some code to our linked <strong>CSS3<\/strong> document. We have linked to our CSS document with the <strong>link<\/strong> element in the <strong>head<\/strong> element of our <strong>HTML5<\/strong> page.<\/p>\n<p><strong>&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;style.css&#8221;&gt;<\/strong><\/p>\n<p>As you can see, we named it <strong>&#8220;style.css&#8221;<\/strong> and in order for this to work correctly, we must put our CSS style sheet at the same level as our <strong>HTML5<\/strong> document in our website. If we decide to put the CSS file in its own folder, it won&#8217;t be linked correctly.<\/p>\n<p>To help old web browsers understand the new HTML5 elements we added to our web page: <strong>header, nav, aside, section, article <\/strong>and<strong> footer<\/strong>, we must add the following code to our CSS style sheet.<\/p>\n<p>We can write it like this:<\/p>\n<p class=\"special\"><strong>article, section, aside, nav, header, footer<\/strong><br \/>\n<strong> {<\/strong><br \/>\n<strong> display: block;<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p>or this:<\/p>\n<p class=\"special\"><strong>article, section, aside, nav, header, footer {display: block;}<\/strong><\/p>\n<p>The web browsers understand both ways of styling the CSS rule. (By the way, a block-level element occupies the entire space of its parent element (container), thereby creating a <strong>block.<\/strong>)<\/p>\n<p>Now in order to position the elements in\u00a0our web page so that each of our <strong>&#8220;sectioning&#8221;<\/strong> elements don&#8217;t just fill up the full width of the page (since they are block elements), we need to use CSS to create a page layout.<\/p>\n<p>CSS layout is something that you will learn through experience, learning the different CSS properties, following tutorials and practicing a lot.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Intro<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/2\/\">Part Two &#8211; How do we apply CSS to HTML?<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/3\/\">Part Three &#8211; The CSS Order of Precedence<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/4\/\">Part Four &#8211; CSS3 Helps Old Web Browsers Understand HTML5<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/5\/\">Part Five &#8211; 3 New Popular Properties in CSS3<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/6\/\">Part Six -Creating a Simple HTML5 Web Page<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/7\/\">Part Seven &#8211; Tutorial Review<\/a><\/li>\n<\/ul>\n<p><!--nextpage--><\/p>\n<h3>Part Five: 3 New Popular Properties in CSS3<\/h3>\n<aside class=\"side note\">\n<h4>New CSS3 Properties<\/h4>\n<ul>\n<li>Border-Radius<\/li>\n<li>Box-Shadow<\/li>\n<li>Opacity<\/li>\n<\/ul>\n<h4>Border Radius<\/h4>\n<\/aside>\n<p><a href=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/html5-and-css3.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-4036 size-full\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/html5-and-css3.gif\" alt=\"HTML5 and CSS3\" width=\"158\" height=\"383\" \/><\/a>With CSS3, the borders around elements can be made rounded without hacks. This is a huge help for designers and developers, who no longer have to rely on Photoshop to create rounded borders.<\/p>\n<p>The new property is called: <strong>border-radius.<\/strong><\/p>\n<p>It applies rounded corners to an element. The radius of our rounded corners in the example below are 5px in every corner. You could specify different values for each corner or choose to only round individual corners.<\/p>\n<p><strong>.side-note {border-radius: 5px; background: #fff;}<\/strong><\/p>\n<p>(In our example above, we have two properties and two values in our declaration. Our selector is <strong>.side-note<\/strong> which refers to an element in our HTML document: <strong>&lt;aside=&#8221;side-note&#8221;&gt;<\/strong><\/p>\n<p>Of course, border-radius is a somewhat new property. So we may need to add some hacks to help old browsers understand our property. By the time you read this, the hacks may no longer be necessary.<\/p>\n<p><strong>.side-note\u00a0{<\/strong><br \/>\n<strong> -moz-border-radius: 5px;<\/strong><br \/>\n<strong> -webkit-border-radius: 5px;<\/strong><br \/>\n<strong> border-radius: 5px;<\/strong><br \/>\n<strong>}<\/strong><\/p>\n<p><strong>You can learn more about border-radius here: <a href=\"http:\/\/css-tricks.com\/almanac\/properties\/b\/border-radius\/\" target=\"_blank\" rel=\"noopener noreferrer\">Border Radius Tutorial<\/a>.<\/strong><\/p>\n<h4>Box Shadows<\/h4>\n<p>Box Shadows are also available in CSS3. They are another great addition. Box Shadows\u00a0used to be created using image editing programs such as Photoshop, but thanks to CSS3 we can now do this with just CSS.\u00a0By default, shadows are drawn on the outside of elements.<\/p>\n<p><strong>.side-note {box-shadow: 3px 3px 7px #777;}<\/strong><\/p>\n<p>CSS Box Shadows take three length values and a color. The length values are a horizontal offset, a vertical offset and a blur.<\/p>\n<p>We may need to add some hacks.\u00a0But by the time you read this, the hacks may no longer be necessary.<\/p>\n<p><strong>.side-note\u00a0\u00a0{<\/strong><br \/>\n<strong>-moz-box-shadow:\u00a03px 3px 7px #777;<\/strong><br \/>\n<strong>-webkit-box-shadow:\u00a03px 3px 7px #777;<\/strong><br \/>\n<strong>box-shadow:\u00a03px 3px 7px #777;<\/strong><br \/>\n<strong>}<\/strong><\/p>\n<p><strong>You can learn more about box-shadow here: <a href=\"http:\/\/www.css3.info\/preview\/box-shadow\/\" target=\"_blank\" rel=\"noopener noreferrer\">Box Shadow Tutorial.<\/a><\/strong><\/p>\n<h4>Opacity<\/h4>\n<p>The opacity property sets the opacity level for an element. The opacity-level describes the transparency-level, where 1 is not transparent at all, 0.5 is 50% see-through, and 0\u00a0is completely transparent.<\/p>\n<p><strong>.side-note {opacity: 0.5;}<\/strong><\/p>\n<p>You can learn more about opacity\u00a0here: <a href=\"http:\/\/www.tutorialrepublic.com\/css-tutorial\/css-opacity.php\" target=\"_blank\" rel=\"noopener noreferrer\">CSS3 Opacity\u00a0Tutorial.<\/a><\/p>\n<p>We&#8217;ve discussed\u00a03 new CSS3 properties here and one old one <strong>(background: #fff;)<\/strong>. <strong>(Background: #fff;)<\/strong> means that the element&#8217;s background will be white.<\/p>\n<p>You can learn more about colors in this\u00a0<a href=\"http:\/\/www.cssportal.com\/css3-color-names\/\" target=\"_blank\" rel=\"noopener noreferrer\">CSS3 color tutorial.<\/a><\/p>\n<p>Let&#8217;s group our properties\u00a0since the selector is the same for each one.<\/p>\n<p><strong>.side-note {border-radius: 5px; background: #ccc;\u00a0box-shadow: 3px 3px 7px #777;\u00a0 opacity: 0.5;}<\/strong><\/p>\n<p>We&#8217;ve styled an element in our HTML5 page. It now has rounded corners, a light gray background color, a shadow behind it. It is also transparent. These are fun properties to work with. Try changing the values and see what happens.<\/p>\n<p>We are now approaching the end of our tutorial. Let&#8217;s create a simple HTML5 web page and a CSS3 stylesheet to go with it.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Intro<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/2\/\">Part Two &#8211; How do we apply CSS to HTML?<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/3\/\">Part Three &#8211; The CSS Order of Precedence<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/4\/\">Part Four &#8211; CSS3 Helps Old Web Browsers Understand HTML5<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/5\/\">Part Five &#8211; 3 New Popular Properties in CSS3<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/6\/\">Part Six -Creating a Simple HTML5 Web Page<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/7\/\">Part Seven &#8211; Tutorial Review<\/a><\/li>\n<\/ul>\n<p><!--nextpage--><\/p>\n<h3>Part Six: Creating a Simple HTML5 Web Page.<\/h3>\n<p>This web page will\u00a0\u00a0be simpler than the one we started in our &#8220;<a href=\"http:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-html-to-html5\/\">Smooth Strides from HTML to HTML5<\/a>&#8221;\u00a0tutorial, but it has many of the same elements.<\/p>\n<p>You can name your page <strong>&#8220;index.html&#8221;<\/strong> and save it in a simple text editor or you can use an HTML editor like Adobe Dreamweaver. Or else just follow along and study the HTML elements and CSS rules.<\/p>\n<div class=\"highlight2\"><strong>&lt;!DOCTYPE html&gt;<\/strong><br \/>\n<strong> &lt;html lang=&#8221;en&#8221;&gt;<\/strong><br \/>\n<strong> &lt;head&gt;<\/strong><br \/>\n<strong>&lt;title&gt;<\/strong>The History of Figure Skating<strong>&lt;\/title&gt;<\/strong><br \/>\n<strong>&lt;meta charset=&#8221;utf-8&#8243;&gt;<\/strong><br \/>\n<strong> &lt;meta name=&#8221;description&#8221; content=&#8221;<\/strong>What is figure skating? Figure skating is a sport in which ice skaters, singly or in pairs, perform freestyle movements of jumps, spins, and lifts in a graceful manner.&#8221;&gt;<br \/>\n<strong> &lt;link rel=&#8221;stylesheet&#8221; href=&#8221;style.css&#8221;&gt;<\/strong><br \/>\n&lt;!&#8211;[if lt IE 9]&gt;<br \/>\n&lt;script src=&#8221;http:\/\/html5shiv.googlecode.com\/svn\/trunk\/html5.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;![endif]&#8211;&gt;<br \/>\n<strong>&lt;\/head&gt;<\/strong><br \/>\n<strong> &lt;body&gt;<\/strong><br \/>\n<strong>&lt;div id=&#8221;wrapper&#8221;&gt;<\/strong><br \/>\n<strong>&lt;h1&gt;<\/strong>The History of Figure Skating<strong>&lt;\/h1&gt;<\/strong><br \/>\n<strong>&lt;aside&gt;&lt;p&gt;<\/strong>Figure Skating is an official event in the Winter Olympics.<strong>&lt;\/p&gt;<\/strong><br \/>\n<strong>&lt;p&gt;&lt;img src=&#8221;figure-skater.gif&#8221; alt=&#8221;figure skater&#8221; width=&#8221;200&#8243; height=&#8221;375&#8243;&gt;&lt;\/p&gt;&lt;\/aside&gt;<\/strong><br \/>\n<strong>&lt;p&gt;&lt;span class=&#8221;special&#8221;&gt;<\/strong>What is figure skating?<strong>&lt;\/span&gt;<\/strong> Figure skating, sport in which ice skaters, singly or in pairs, perform freestyle movements of jumps, spins, lifts, and footwork in a graceful manner.<strong>&lt;\/p&gt;<\/strong><br \/>\n<strong>&lt;p&gt;<\/strong>Its name derives from the patterns skaters make on the ice, an element that was a major part of the sport until recently. There are various kinds of figure skating, including freestyle, pairs, ice dance, and synchronized team skating.\u00a0<strong>&lt;\/p&gt;<\/strong><br \/>\n<strong>&lt;p&gt;<\/strong>The founder of modern figure skating, as it is known today, was Jackson Haines, an American. Haines was known as the first skater to incorporate ballet and dance movements into his skating, as opposed to focusing on tracing patterns on the ice.<strong>&lt;\/p&gt;<\/strong><br \/>\n<strong>&lt;p&gt;<\/strong> Haines also invented the sit spin and developed a shorter, curved blade for figure skating that allowed for easier turns. He was also the first to wear blades that were permanently attached to the boot.<strong>&lt;\/p&gt;<\/strong><br \/>\n<strong>&lt;\/div&gt;<\/strong><strong>&lt;\/body&gt;<\/strong><strong>&lt;\/html&gt;<\/strong><\/div>\n<p><strong>NOTE:<\/strong> The link element in the head section of the &#8220;index.html&#8221; page links the <strong>HTML5<\/strong> document to the <strong>Cascading Style Sheet.<\/strong><\/p>\n<ul>\n<li>The very first line:\u00a0&lt;!DOCTYPE html&gt; makes it an HTML5 document.<\/li>\n<li>We will give our page a nice light blue background with a\u00a0<strong>body<\/strong>\u00a0attribute in our cascading style sheet that refers to our body element in our HTML page.\u00a0We will also list\u00a0 the font we want to use for everything in our web page, which is<strong>\u00a0&#8220;verdana.&#8221;\u00a0<\/strong>We will write it in\u00a0our cascading style sheet.<\/li>\n<li>We are adding one <strong>&#8220;div&#8221; <\/strong>element called<strong> &#8220;wrapper&#8221;<\/strong> to enclose all our information about figure skating. It starts out with <strong>&lt;div id=&#8221;wrapper&#8221;&gt;<\/strong> and ends down near the bottom of the page with <strong>&lt;\/div&gt;. <\/strong>We will give it a width and some margins in our cascading style sheet. We will give it margins of 20px on top and bottom and <strong>&#8220;auto&#8221;<\/strong> on the left and right side. This enables us to center it in the web browser. We&#8217;ve also given it a drop shadow.<\/li>\n<li>We have one heading element: h1 and many sets of p tags &lt;p&gt;&lt;\/p&gt;. Inside our p tags, we have a lot of text. We\u00a0will\u00a0center our h1 element, but not our paragraphs. We will also give our\u00a0<strong>h1<\/strong> and <strong>p<\/strong> elements relative sizes in our cascading style sheet.<\/li>\n<li>We&#8217;ve added a <strong>span<\/strong> element inside one of our paragraphs and will give\u00a0it the same color as our <strong>h1<\/strong> element. \u00a0We will also give\u00a0it a <strong>font-weight: bold;<\/strong> declaration in our cascading style sheet so it stands out a little. Notice that a <strong>span<\/strong> element can go inside a p element in our HTML5 document, but a <strong>div<\/strong> element cannot.<\/li>\n<li>We also have one image that we have included with the <strong>img<\/strong> element. It has no ending tag because it is a VOID element.<\/li>\n<li>We&#8217;ve also added one HTML5 semantic\/structural element: <strong>aside.<\/strong> We are using it like a\u00a0pull quote. It is not necessary in the flow of information and can be moved to the side of the page. We will float it to the right and give it a width with our cascading style sheet. We will also round the corners of it and\u00a0be sure to add <strong>&#8220;display: block&#8221;<\/strong> to it as well.<\/li>\n<\/ul>\n<p>Notice that we have\u00a0included our image inside a\u00a0paragraph\u00a0inside our\u00a0<strong>aside<\/strong> element. But you shouldn&#8217;t\u00a0put a paragraph inside an image and you\u00a0shouldn&#8217;t put the\u00a0<strong>aside<\/strong> element inside our paragraph. We discussed block-level and inline-level elements in our <strong><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-html-to-html5\/\">&#8220;Smooth Strides from HTML to HTML5<\/a>&#8221; tutorial.<\/strong><\/p>\n<p>Let&#8217;s\u00a0create our cascading style sheet and name it <strong>&#8220;style.css&#8221;\u00a0<\/strong>in a simple text editor.<\/p>\n<div class=\"highlight2\">\n<p><strong>body<\/strong> {background: #7db3ca; font-family: verdana, sans-serif;}<\/p>\n<p><strong>#wrapper<\/strong> {background: #fff; padding: 20px;<br \/>\nwidth: 600px; margin: 20px auto;<br \/>\n-moz-box-shadow: 0 0 2px 2px #bbb;<br \/>\n-webkit-box-shadow: 0 0 2px 2px #bbb;<br \/>\nbox-shadow: 0 0 2px 2px #bbb;}<\/p>\n<p><strong>aside<\/strong> {display: block; width: 220px; float: right;<br \/>\nmargin: 10px 10px 10px 30px; padding: 10px;<br \/>\nborder-radius: 15px; background: #e5e5e5;<br \/>\nborder: 1px solid #ccc; text-align: center;}<\/p>\n<p><strong>h1<\/strong> {margin: 20px 0; color: #7db4cb; font-size: 1.2em; text-align: center;}<\/p>\n<p><strong>p<\/strong> {margin: 20px 0; font-size: 1em;}<\/p>\n<p><strong>span<\/strong> {color: #7db4cb; font-weight: bold;}<\/p>\n<p><strong>img<\/strong> {margin: 10px;}<\/p>\n<\/div>\n<p>Here is a smaller representation of the web page we have created. This is how most web browsers will interpret the code that we wrote for our HTML5 document and linked CSS3 style sheet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4047\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/history-of-figure-skating.gif\" alt=\"history of figure skating example web page\" width=\"497\" height=\"498\" \/><\/p>\n<p>Thanks to Webucator, a provider of customized <a href=\"https:\/\/www.webucator.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">web design training,<\/a> for producing this video showing how we created this simple HTML5 page.<\/p>\n<div class=\"iframeWrap\"><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/901UehvprK0?rel=0\" width=\"300\" height=\"150\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<p>In Part Seven, we will review what we&#8217;ve learned and add an HTML5 and CSS3 <strong>&#8220;infographic&#8221;<\/strong> which will mention the main points of our discussion.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Intro<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/2\/\">Part Two &#8211; How do we apply CSS to HTML?<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/3\/\">Part Three &#8211; The CSS Order of Precedence<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/4\/\">Part Four &#8211; CSS3 Helps Old Web Browsers Understand HTML5<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/5\/\">Part Five &#8211; 3 New Popular Properties in CSS3<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/6\/\">Part Six -Creating a Simple HTML5 Web Page<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/7\/\">Part Seven &#8211; Tutorial Review<\/a><\/li>\n<\/ul>\n<p><!--nextpage--><\/p>\n<h3>Part Seven: Tutorial Review<\/h3>\n<p><strong>HTML5<\/strong> and <strong>CSS3<\/strong> can be fun to learn, but also frustrating at times. They take a bit of practice, but it&#8217;s\u00a0worth your effort to learn to code HTML5 from scratch (if you are serious about becoming a web designer).<\/p>\n<ul>\n<li>Frustrated with your HTML5 page? The <a href=\"http:\/\/validator.w3.org\">W3C markup validator<\/a>\u00a0or \u00a0<a href=\"http:\/\/html5.validator.nu\" target=\"_blank\" rel=\"noopener noreferrer\">Validator.nu (X)HTML5 Validator<\/a>\u00a0will help you figure out\u00a0if you are\u00a0coding your pages\u00a0properly.<\/li>\n<li>Frustrated with your CSS3 style sheet? Learn about <strong>CSS Order of Precedence. <\/strong>It may be the solution to the problem you are trying to solve.<\/li>\n<\/ul>\n<p>Here&#8217;s an INFOGRAPHIC to help you review the main points of both tutorials:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4048\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2014\/11\/html5-and-css3-infographic.gif\" alt=\"Infographic\" width=\"480\" height=\"1380\" \/><\/p>\n<h4>See Larger Infographic: <a href=\"http:\/\/www.crimsondesigns.com\/blog\/html5-and-css3-infographic\/\">HTML5 and CSS3 INFOGRAPHIC for Beginners.<\/a><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>In this beginner CSS tutorial, we&#8217;ll start slow with simple explanations of HTML and CSS, then we&#8217;ll push forward into CSS3, the latest version of CSS, and explain a few things about HTML5&#8217;s wonderful sidekick. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,9],"tags":[43,50,92],"class_list":{"0":"post-4016","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-html-and-css","7":"category-web-design","8":"tag-cascading-style-sheets","9":"tag-css3","10":"tag-html5","11":"cat-5-id","12":"cat-9-id"},"_links":{"self":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts\/4016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=4016"}],"version-history":[{"count":1,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts\/4016\/revisions"}],"predecessor-version":[{"id":7758,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts\/4016\/revisions\/7758"}],"wp:attachment":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=4016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=4016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=4016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}