<ul>
<h2>Hello World</h2>
<li>Item</li>
<li>Item/li>
</ul>
<div>
<h1>Title</h1>
<p>
Paragraph
</div>
</p>
Page Title
Lorem ipsum dolor sit amet.
Come after the initial tag declaration.
Typically a name value pair.
Changes how elements look or act.
Some tags have unique attributes.
Block level elements always start a new line and span the full width of available space
<div>
<div>This is my first div</div>
<div>
This is my second div
<p>
Paragraphs are block elements too.
</p>
</div>
</div>
Paragraphs are block elements too.
Inline elements do not start a new line.
<p>
<span>These</span>
<strong>are </strong>
<span>all</span>
<em>in different inline</em>
<span>elements</span>
</p>
These are all in different inline elements
The subscript and superscript tags are used to move blocks of text half a character up or down a line
<p>
This text contains a <sub>subscript</sub>.
This text contains a <sup>superscript</sup>
</p>
This text contains a subscript. This text contains a superscript
We will cover more in future classes, but you can find them here.
Use the ID attribute to be able to specifically target an element. IDs must be unique. You will get inconsistent results if there are multiple elements with the same ID.
<div id="site-header">
<h1 id="myTitle">My Title</h1>
</div>
The Class attribute is used to reference a class in a Style Sheet. You can also target an element by in JavaScript by its class.
Title 1
Desc 1
Title 2
Desc 2
CSS stands for Cascading Style Sheet. CSS allows you to modify how your HTML is displayed without changing any HTML.
These two sites have the exact same HTML, but very different CSS. Site 1 and Site 2
There are 3 primary ways.
The third method is the most desired approach.
a {
color: #aa0000;
font-size: 20px;
height: 25px;
margin: 20px;
padding: 20px;
}
This is done with the style attribute.
Header
Header
A selector is a pattern used to target specific HTML elements
h1 {
color:red;
text-align: center;
}
Know this for FE interviews!!!
CSS selectors vary in size length and complexity, but they are primarily based off of 3 core selector methods.
The tag selector simply uses the tag name to target an element. This is the most global way to set default styles
h1 {
color: red; /*All h1s will be red*/
}
span {text-decoration: underline;} /*All spans will be underlines*/
This is the most common method of targeting elements.
This is one of the most specific selectors.
Text goes here
h1 {color: blue;}
.site-header {color: red;}
#my-header {color: green;}
Text goes here
h1 {color: blue;}
h1 {color: red !important}
.site-header {color: orange;}
#my-header {color: green;}
There are a number of different types of values for CSS. These are some of the more common ones.
.class {
font-size: 1.1em;
margins: 20px;
width: 75%;
}
These are several properties that can be used to modify the look of our text we have created.
Primary valid values: left,
right,
center,
and justify
Primary valid values: none,
underline,
line-through,
and overline
See the Pen ITR - CSS - Text by Jon (@Middaugh) on CodePen.
These CSS properties actually change the appearance of the characters in the font.
h1{
font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;
font-size: 18px;
}
normal
, italic
, and oblique
normal
and
bold
h1{
font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;
font-size: 18px;
font-style: italic;
font-weight:bold;
}
/*
Everything in here is a comment
*/
Practice your HTML by performing the following updates to the Pen.
Add new html tags into our Pen.
Modify your html to include some IDs and Classes
Add CSS in the CSS panel to apply the following rules.
I've seen this site used in interviews
CSS DinerIt will need the following.