Web Design
Lecture & Discussion:
The CSS Box Model: �<div> Elements & HTML5 Semantics
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Web Literacy
Structure/Semantics
Hypertext Markup Language (HTML)
HTML documents provide the structure of a website. An HTML document is comprised of a system of <tags> </tags> �that describe (or “markup”) the content of a webpage.
Style/Design
Cascading Style Sheets (CSS)
CSS rulesets hold the visual instructions for each HTML <tag>, using selectors, {declarations: and values;}.
html
css
Web Literacy
Structure/Semantics (HTML)
+
Style/Design (CSS)
=
Browser Display (WWW)
An Internet browser (such as Chrome, Firefox, Internet Explorer, or Safari) is software that is able to read and synthesize web-based media and coding languages, including audio/video/imagery, such as HTML, CSS, JavaScript, PHP, Python, Flash, etc.
html
css
www
Clients & Servers
Clients are software (like internet browsers) and hardware (like smartphones, tablets, and laptop computers) that use a network connection (like the Internet) to access information provided by a server
www
Clients & Servers
Clients
&
Servers are the software and hardware that make the Internet possible. They provide clients with files and services via HTTP; they are computers that store, process, and deliver websites to clients
www
Clients & Servers
html
css
html
css
The�Internets
(Clients)
HTTP
HTTP
FTP
FTP
FTP
Your
Website
(Hosted)
Your
Site
(Local)
Hosting Service Data Center (Server)
Your Computer, �Los Angeles, CA
(Client)
HTML Syntax
Structure/Semantics
<html>
<head>
<title>My site</title>
</head>
<body>
<h1>My site</h1>
<h2>Welcome to my site!</h2>
</body>
</html>
html
HTML Syntax
Structure/Semantics
Most HTML elements consist of an opening <tag> and a closing </tag>. Some elements have content or other tags nested inside them. The image tag <img> opens and closes in the same tag (it’s an unpaired tag), with an attribute src="" for the image source.
<p>This <em>is</em> a paragraph.</p>
<img src="cat.jpg">
html
HTML Syntax
Structure/Semantics
<p>This is a paragraph.</p>
An HTML Element has three parts:
Open tag
Element content
Close tag
html
HTML Syntax
Structure/Semantics
<img src="funny-cat.gif">
An HTML Void Element has four parts:
Open tag
Attribute
Attribute Value
Close bracket
html
CSS Syntax
Style/Design
p {
Xxx font-size: 12pt; Xxx
}
A CSS Rule Set has four parts:
Selector {
xxxxDeclaration Block Property-Name: Property-Value; xxxx
}
css
File Naming Conventions
Best Practices for Naming Files
no%20spaces%20ever.html
hyphens-are-ok.html
underscores_are_also_cool.html
NEVER-UPPERCASE-EVER.html
always-lowercase-everything.html
nº--$pe©i@l--©h@®@çters!!!!.html
less-than-thirty-letters-long.html
Folder Structure
root-directory
The folder that you build all of your HTML and CSS files in is called a root-directory. Folders inside of the root directory (such as “css,” “img,” and “pages”) are called sub-directories.
Folder Structure
Root Directory
Index index.html
CSS Folder stylesheet.css
Images Folder
Pages Folder
css
html
html
html
html
html
css
html
img
pages
fi-la
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
HTML <div> Elements
HTML <div> Elements
<div> </div>
We use the HTML division elements to create �boxes that hold the content on our web page.
HTML <div> Elements
<div> </div>
We use the HTML division elements to create �boxes that hold the content on our web page.
A <div> </div> is like a Rectangle Frame �that you might use in design software �(such as Adobe InDesign or Illustrator):
HTML <div> Elements
<div> </div>
We use the HTML division elements to create �boxes that hold the content on our web page.
A <div> </div> is like a Rectangle Frame �that you might use in design software �(such as Adobe InDesign or Illustrator):
HTML <div> Elements
<div> </div>
We use the HTML division elements to create �boxes that hold the content on our web page.
A <div> </div> is like a Rectangle Frame �that you might use in design software �(such as Adobe InDesign or Illustrator):
The <div> element is typically used to hold on to content like text, images, or videos, but it’s also useful for page composition.
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
The CSS Box Model
The CSS Box Model
All <div> </div> elements can be considered boxes:
The CSS Box Model
All <div> </div> elements can be considered boxes:
The CSS Box Model
All <div> </div> elements can be considered boxes:
The CSS Box Model is an approach to building a website based on a structure of <div> </div> elements and stacking/nesting them like boxes.
The CSS Box Model
The CSS Box Model
So if we look at any website, we can start to imagine a very simple combination of “boxes” (or HTML <div> elements) that might be used to structure the page.
The CSS Box Model
So if we look at any website, we can start to imagine a very simple combination of “boxes” (or HTML <div> elements) that might be used to structure the page.
For instance, look at the login page for Facebook.com and try to imagine the simplest combination of HTML <div> elements that could be used to compose the page:
This is a Box
This is a Box
This is a Box
So this particular website layout is basically �just three big boxes stacked vertically!
So this particular website layout is basically �just three big boxes stacked vertically!
We can create this layout structure �in the HTML using three <div> elements.
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
The CSS Box Model
Great! So we can start to imagine a very basic structure for the page: just three boxes (HTML <div> elements) stacked on top of each other vertically.
The CSS Box Model
Great! So we can start to imagine a very basic structure for the page: just three boxes (HTML <div> elements) stacked on top of each other vertically.
But if we look closer, we notice that there seems to be some additional structure within some of those boxes:
This is a box
This is a box
<div> </div>
<div> </div>
<div> </div>
And they both are nested inside of this box
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
This is a box
<div> </div>
<div> </div>
<div> </div>
This is a box
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
And they are both nested inside of this box
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
This is a box. It doesn’t look like it has any other boxes nested inside of it.
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
The CSS Box Model
Awesome! So we started with a very basic structure for the page: just three boxes (HTML <div> elements) stacked on top of each other vertically:
<div> </div>
<div> </div>
<div> </div>
The CSS Box Model
Awesome! So we started with a very basic structure for the page: just three boxes (HTML <div> elements) stacked on top of each other vertically.
Then we added in some additional boxes inside of those boxes:
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
The CSS Box Model
Awesome! So we started with a very basic structure for the page: just three boxes (HTML <div> elements) stacked on top of each other vertically.
Then we added in some additional boxes inside of those boxes.
This is how we should think about building our web pages: As a combination of boxes stacked next to or on top of other boxes. �That’s the CSS Box Model strategy of web page design!
The CSS Box Model
The CSS Box Model
There are four basic components �to each HTML <div> </div> element.
The CSS Box Model
There are four basic components �to each HTML <div> </div> element.
These components dictate the size and spacing �of HTML <div> </div> elements on the page:
The CSS Box Model
There are four basic components �to each HTML <div> </div> element.
These components dictate the size and spacing �of HTML <div> </div> elements on the page:
The CSS Box Model
There are four basic components �to each HTML <div> </div> element.
These components dictate the size and spacing �of HTML <div> </div> elements on the page:
The CSS Box Model
There are four basic components �to each HTML <div> </div> element.
These components dictate the size and spacing �of HTML <div> </div> elements on the page:
The CSS Box Model
There are four basic components �to each HTML <div> </div> element.
These components dictate the size and spacing �of HTML <div> </div> elements on the page:
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Content, padding, border, margin
Content, padding, border, margin
Let’s declare some <div> </div> elements in our HTML.
Content, padding, border, margin
<div></div>
Let’s declare some <div> </div> elements in our HTML.
Content, padding, border, margin
<div></div>
Let’s declare some <div> </div> elements in our HTML. Then put some dummy “Lorem ipsum” text inside of them.
Content, padding, border, margin
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</div>
Let’s declare some <div> </div> elements in our HTML. Then put some dummy “Lorem ipsum” text inside of them.
Content, padding, border, margin
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</div>
Let’s declare some <div> </div> elements in our HTML. Then put some dummy “Lorem ipsum” text inside of them.
We know that these <div> elements should go between the <body> and </body> element tags, because that’s where all of the display content on the web page belongs.
Content, padding, border, margin
Content, padding, border, margin
div {
width: 150px;
margin: 40px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
In a linked CSS stylesheet, let’s mess with some of the basic property declarations for the <div>, like width, margin, border, and padding.
Also give the <div> a background-color property declaration, to help see it on your page.
Content, padding, border, margin
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
div {
width: 150px;
margin: 40px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
Content, padding, border, margin
(margin-right)
(margin-top)
(margin-bottom)
(margin-left)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
div {
width: 150px;
margin: 40px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
Content, padding, border, margin
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
div {
width: 150px;
margin: 40px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
(margin-top)
(border-top)
(border-bottom)
(margin-bottom)
(margin-right)
(border-right)
(margin-left)
(border-left)
Content, padding, border, margin
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
div {
width: 150px;
margin: 40px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
(margin-top)
(border-top)
(padding-top)
(padding-bottom)
(border-bottom)
(margin-bottom)
(margin-right)
(border-right)
(padding-right)
(margin-left)
(border-left)
(padding-left)
Content, padding, border, margin
Content, padding, border, margin
The CSS property declarations margin, border, �and padding are all shorthand declarations.
Content, padding, border, margin
So when we declare a property value to the shorthand declaration margin, the CSS actually applies the value to the longhand properties margin-top, margin-right, margin-bottom, and margin-left (in that order, like a clock, moving clockwise from the top position).
Content, padding, border, margin
So this CSS shorthand:
div {
margin: 40px;
}
Content, padding, border, margin
So this CSS shorthand: Is the same as this:
div {
margin-top: 40px;
margin-right: 40px;
margin-bottom: 40px;
margin-left: 40px;
}
div {
margin: 40px;
}
Content, padding, border, margin
And when we declare a property value to the shorthand declaration padding, the CSS actually applies the value to the longhand properties padding-top, padding-right, padding-bottom, and padding-left.
Content, padding, border, margin
So this CSS shorthand:
div {
padding: 40px;
}
Content, padding, border, margin
So this CSS shorthand: Is the same as this:
div {
padding-top: 40px;
padding-right: 40px;
padding-bottom: 40px;
padding-left: 40px;
}
div {
padding: 40px;
}
Content, padding, border, margin
And when we declare a property value to the shorthand declaration border, the CSS actually applies the value to the longhand properties border-width, border-style, and border-color.
Content, padding, border, margin
So this CSS shorthand:
div {
border: 4px solid orange;
}
Content, padding, border, margin
So this CSS shorthand: Is the same as this:
div {
border-width: 4px;
border-style: solid;
border-color: orange;
}
div {
border: 4px solid orange;
}
Content, padding, border, margin
To save ourselves time, it makes sense to try to use shorthand CSS declarations as often as possible.
We might choose to use longhand CSS declarations if we want our <div> elements to have different values on different sides of the box.
Content, padding, border, margin
div {
margin-top: 80px;
margin-bottom: 80px;
border: 4px solid orange;
border-top: 4px dashed cyan;
padding-left: 20px;
padding-right: 40px;
background-color: lime;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
Content, padding, border, margin
div {
margin-top: 80px;
margin-bottom: 80px;
border: 4px solid orange;
border-top: 4px dashed cyan;
padding-left: 20px;
padding-right: 40px;
background-color: lime;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
(padding-left)
(padding-right)
(margin-top)
(border-top)
(border-bottom)
(margin-bottom)
Content, padding, border, margin
Content, padding, border, margin
Because all <div> </div> elements are block-level elements, we can center a <div> </div> on the page by setting the margin-left: auto; and the margin-right: auto; in the linked CSS stylesheet.
Content, padding, border, margin
Centering DIVs using auto margins:
div {
margin: auto;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
HTML5 Semantic Element Tags
HTML5 Semantic Element Tags
Semantic elements are just like the division element <div> </div>, but semantic elements clearly describe their meaning for both humans and computers.
HTML5 Semantic Element Tags
Semantic elements are just like the division element <div> </div>, but semantic elements clearly describe their meaning for both humans and computers.
<div> is non-semantic, a blank, meaningless element. BAD!!!!!
HTML5 Semantic Element Tags
Semantic elements are just like the division element <div> </div>, but semantic elements clearly describe their meaning for both humans and computers.
<div> is non-semantic, a blank, meaningless element. BAD!!!!!
<div id="header"> only has semantic meaning for humans. Computers can’t make sense of this, its meaning is illegible. BAD!!!
HTML5 Semantic Element Tags
Semantic elements are just like the division element <div> </div>, but semantic elements clearly describe their meaning for both humans and computers.
<div> is non-semantic, a blank, meaningless element. BAD!!!!!
<div id="header"> only has semantic meaning for humans. Computers can’t make sense of this, its meaning is illegible. BAD!!!
<header> is semantic for both humans and computers, which vastly improves legibility and SEO (Search Engine Optimization). GOOD!!!!!
HTML5 Semantic Element Tags
HTML5 Semantic Element Tags
So from now on, we should never use semantically meaningless <div> division elements ever again.
HTML5 Semantic Element Tags
So from now on, we should never use semantically meaningless <div> division elements ever again.
We should only use HTML5 Semantic Element Tags!
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
Like all display content, HTML5 Semantic Tags should always nest inside of the <body> tags
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <header> holds the headline information, it’s a container for introductory content
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <nav> is for a group of navigation links in ordered <ol> or unordered <ul> lists and list items <li>
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <main> tag should hold on to unique content for the page, so elements such as <header> and <nav> (which are usually repeated across many pages) are not part of the <main> tag
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <section> tag marks a thematic grouping of content, typically with a heading like the <h3> tag
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article> <h4></h4>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <article> tag is for self-contained body content. This content should make sense on its own, and it should be possible to read it independent of the rest of the website
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article> <h4></h4>
<figure>
<figcaption></figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <figure> tag is for visuals, imagery, photography, video, etc.
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article> <h4></h4>
<figure>
<figcaption> </figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <figcaption> tag is for captions that explain the <figure>, a caption or credit for the imagery
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article> <h4></h4>
<figure>
<figcaption> </figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
The <footer> tag is for copyright information, terms of use, contact information, social media links, email list sign-up, etc.
HTML5 Semantic Element Tags
<body>
<header> <h1></h1> <h2></h2> </header>
<nav> <ul> <li></li> </ul> </nav>
<main>
<section> <h3></h3>
<article> <h4></h4>
<figure>
<figcaption> </figcaption>
</figure>
</article>
</section>
</main>
<footer> </footer>
</body>
HTML5 Semantic Element Tags
The Semantic Web
HTML5 Semantic Element Tags
The Semantic Web
The Semantic Web provides a common framework �that allows data to be shared and reused across �application, enterprise, and community boundaries.
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
CSS Reset
CSS Reset
We’ve noticed that the Internet browser introduces styles to elements, even when we haven’t specifically asked it to do so.
CSS Reset
For instance, the <h1> tag has a number of preset styles…
CSS Reset
For instance, the <h1> tag has a number of preset styles…
h1 {
font-size: 24pt;
font-family: "Times New Roman";
color: black;
}
CSS Reset
Almost every element on the page, including the <html> and <body> elements, have at least margin and padding values by default…
CSS Reset
Almost every element on the page, including the <html> and <body> elements, have at least margin and padding values by default…
div {
margin: 5px;
padding: 5px;
}
CSS Reset
If we want to reset those CSS presets, we have a selector that can apply declarations to every element on the page at once: the Universal Selector *
CSS Reset
If we want to reset those CSS presets, we have a selector that can apply declarations to every element on the page at once: the Universal Selector *
* {
margin: 0;
padding: 0;
}
CSS Reset
Here, we’ve used the Universal Selector to get rid of all of the preset margin and padding values of every element.
* {
margin: 0;
padding: 0;
}
CSS Reset
Since CSS applies styles to elements in the page-build order, we can always apply new style declarations to elements further on down the document.
CSS Reset
Since CSS applies styles to elements in the page-build order, we can always apply new style declarations to elements further on down the document.
* {
margin: 0;
padding: 0;
}
div {
margin: 0;
padding: 0;
}
CSS Reset
So here, even though the Universal Selector * is telling every element on the page to have no margin or padding, the rule set for div overrides that declaration.
* {
margin: 0;
padding: 0;
}
div {
margin: 25px;
padding: 40px;
}
CSS Reset
As with any CSS rule set, you can add as many declarations to your CSS reset as you like…
CSS Reset
A typical CSS Reset clears out the margins and padding and gets rid of numbers and bullet points for ordered and unordered lists.
CSS Reset
A typical CSS Reset clears out the margins and padding and gets rid of numbers and bullet points for ordered and unordered lists.
* {
margin: 0;
padding: 0;
list-style-type: none;
}
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
CSS display Property
CSS display Property
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</div>
Let’s go ahead and declare a few more <div> </div> elements in our HTML with some dummy text so that we can see how the display: property affects how they behave in relationship to each other.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
The <div> </div> element is a block-level element, so unless otherwise defined or nested, the element will expand and drop below other block-level elements.
CSS display Property
The <div> </div> element is a block-level element, so unless otherwise defined or nested, the element will expand and drop below other block-level elements.
<h1> </h1> is a block-level element
<ul> </ul> is a block-level element
<ol> </ol> is a block-level element
<li> </li> is a block-level element
<p> </p> is a block-level element
CSS display Property
div {
display: block;
width: 150px;
margin: 10px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Notice that the <div> </div> elements stack vertically when their display: property is set to block;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Notice that the <div> </div> elements stack vertically when their display: property is set to block;
This might seem a bit counterintuitive: Because there is plenty of empty space to the right of each element, we might expect them to stack horizontally.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Notice that the <div> </div> elements stack vertically when their display: property is set to block;
This might seem a bit counterintuitive: Because there is plenty of empty space to the right of each element, we might expect them to stack horizontally.
???
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Notice that the <div> </div> elements stack vertically when their display: property is set to block;
This might seem a bit counterintuitive: Because there is plenty of empty space to the right of each element, we might expect them to stack horizontally.
???
???
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Notice that the <div> </div> elements stack vertically when their display: property is set to block;
This might seem a bit counterintuitive: Because there is plenty of empty space to the right of each element, we might expect them to stack horizontally.
But the fact that they are set to block; forces them to stack vertically.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
The <a> </a> element is an inline element, so unless otherwise defined or nested, the element will occupy only as much space as necessary to display the content, and other inline elements can sit on the same line.
CSS display Property
The <a> </a> element is an inline element, so unless otherwise defined or nested, the element will occupy only as much space as necessary to display the content, and other inline elements can sit on the same line.
<a> </a> is an inline element
<button> </button> is an inline element
<del> </del> is an inline element
<em> </em> is an inline element
<img> is an inline element
<input> is an inline element
<span> </span> is an inline element
<strong> </strong> is an inline element
CSS display Property
div {
display: inline;
width: 150px;
margin: 10px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Notice that <div> elements don’t really like having their display: changed to inline; because inline elements ignore width and height declarations, so things tend to start looking weird when we change block-level elements to inline;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco…
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
div {
display: inline-block;
width: 150px;
margin: 10px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Great! So we see that setting the display: of our <div> </div> elements to inline-block; is a good way to get them to stack horizontally across the page.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Great! So we see that setting the display: of our <div> </div> elements to inline-block; is a good way to get them to stack horizontally across the page. Remember that this applies to any block-level elements that you might want to stack horizontally rather than vertically (for instance, the list items <li> </li> in a navigation interface)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
We use the display: property as our primary tool �to control the layout of the <div> elements on our page.
CSS display Property
div {
display: none;
width: 150px;
margin: 10px;
border: 4px solid orange;
padding: 40px;
background-color: lime;
}
We can’t see anything!
We can’t see anything! Changing the display: of our <div> </div> elements to none; just turns them off – they won’t display on the page and they won’t affect the position or layout of other elements.
We can’t see anything! Changing the display: of our <div> </div> elements to none; just turns them off – they won’t display on the page and they won’t affect the position or layout of other elements. This can be a helpful tool for prototyping and troubleshooting: Consider just turning some elements off using display: if something isn’t working properly on your page!
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
IDs & Classes
IDs & Classes
The id="____" and class="____" attributes are placed inside the opening <tag> of an HTML element.
IDs & Classes
The id="____" and class="____" attributes are placed inside the opening <tag> of an HTML element.
Just like other HTML attributes that we have already used (such as src="____" or href="____") these attributes modify the element that we apply them to.
IDs & Classes
The id="____" and class="____" attributes are placed inside the opening <tag> of an HTML element
Just like other HTML attributes that we have already used (such as src="____" or href="____") these attributes modify the element that we apply them to.
Attributes such as id="____" and class="____" are simply a tool to give us more control over the display of elements on the page.
IDs & Classes
IDs & Classes
Serial Numbers
id="____"
IDs & Classes
Serial Numbers vs.
id="____"
IDs & Classes
Serial Numbers vs. Barcodes
id="____" //class="____"
IDs & Classes
IDs are like serial numbers – use �them to refer to only one element.
IDs & Classes
IDs are like serial numbers – use �them to refer to only one element.
<h2>Section Two</h2>
Section One
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Section Two
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
IDs & Classes
IDs are like serial numbers – use �them to refer to only one element.
<h2 id="section-two">Section Two</h2>
h2#section-two {
margin-top: 10px;
border-top: 2px dashed red;
padding-top: 10px;
}
Section One
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Section Two
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
IDs & Classes
IDs & Classes
IDs & Classes
Classes are like barcodes – use �them to refer to lots of elements.
IDs & Classes
Classes are like barcodes – use �them to refer to lots of elements.
<h4>Paragraph #1</h4>
…
<h4>Paragraph #2</h4>
…
<h4>Paragraph #3</h4>
Paragraph #1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph #2
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Paragraph #3
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
IDs & Classes
Classes are like barcodes – use �them to refer to lots of elements.
<h4 class="magenta">Paragraph #1</h4>
…
<h4 class="magenta">Paragraph #2</h4>
…
<h4 class="magenta">Paragraph #3</h4>
Paragraph #1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph #2
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Paragraph #3
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
IDs & Classes
Classes are like barcodes – use �them to refer to lots of elements.
<h4 class="magenta">Paragraph #1</h4>
…
<h4 class="magenta">Paragraph #2</h4>
…
<h4 class="magenta">Paragraph #3</h4>
.magenta {
color: magenta;
}
Paragraph #1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph #2
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Paragraph #3
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
IDs & Classes
Also, unlike the id attribute, any HTML element can take lots of different class values in one attribute.
IDs & Classes
Also, unlike the id attribute, any HTML element can take lots of different class values in one attribute.
<h4 class="magenta">Paragraph #1</h4>
…
<h4 class="magenta">Paragraph #2</h4>
…
<h4 class="magenta">Paragraph #3</h4>
Paragraph #1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph #2
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Paragraph #3
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
IDs & Classes
Also, unlike the id attribute, any HTML element can take lots of different class values in one attribute.
<h4 class="magenta underline capitalize">Paragraph #1</h4>
…
<h4 class="magenta">Paragraph #2</h4>
…
<h4 class="magenta">Paragraph #3</h4>
Paragraph #1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph #2
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Paragraph #3
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
IDs & Classes
Also, unlike the id attribute, any HTML element can take lots of different class values in one attribute.
<h4 class="magenta underline capitalize">Paragraph #1</h4>
…
<h4 class="magenta">Paragraph #2</h4>
…
<h4 class="magenta">Paragraph #3</h4>
.magenta {
color: magenta;
}
.underline {
text-decoration: underline;
}
.capitalize {
text-transform: uppercase;
}
PARAGRAPH #1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph #2
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Paragraph #3
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
CSS Pseudo-Classes
CSS Pseudo-Classes
Pseudo-classes are used to define a special state �of an element.
CSS Pseudo-Classes
Pseudo-classes are used to define a special state �of an element. Pseudo-classes give us richer control over user interactions.
CSS Pseudo-Classes
Pseudo-classes are used to define a special state �of an element. Pseudo-classes give us richer control over user interactions.
By default, only <a href="page.html"> anchor tag links </a> have pseudo-class styles, but we can apply pseudo-classes to any element on the page.
CSS Pseudo-Classes
a:link {
color: blue;
text-decoration: underline;
}
CSS Pseudo-Classes
Hi, I’m just a default anchor
CSS Pseudo-Classes
a:link { a:visited {
color: blue; color: purple;
text-decoration: underline; text-decoration: underline;
} }
CSS Pseudo-Classes
Hi, I’m just a default anchor
Hi, I’m a default visited anchor
CSS Pseudo-Classes
a:link { a:visited {
color: blue; color: purple;
text-decoration: underline; text-decoration: underline;
} }
a:hover {
color: blue;
text-decoration: underline;
}
CSS Pseudo-Classes
Hi, I’m just a default anchor
Hi, I’m a default visited anchor
Hi, I’m a default anchor during hover
CSS Pseudo-Classes
a:link { a:visited {
color: blue; color: purple;
text-decoration: underline; text-decoration: underline;
} }
a:hover { a:active {
color: blue; color: red;
text-decoration: underline; text-decoration: underline;
} }
CSS Pseudo-Classes
Hi, I’m just a default anchor
Hi, I’m a default visited anchor
Hi, I’m a default anchor during hover
Hi, I’m a default active anchor
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Quick Review
Web Literacy, Syntax, Clients & Servers, File Naming Conventions, Folder Structure
DIVs
HTML <div> Elements, The CSS Box Model, �Content, padding, border, margin
HTML5 Semantic Tags
CSS Reset
CSS display Property
IDs, Classes, Pseudo-classes
Web Design is an open-source learning resource.
Class material developed by Ian Besler.�
Licensed under a Creative Commons�Attribution-NonCommercial-ShareAlike�4.0 International License.