On Github Roenok / triangle-techgirlz-htmlcss
HTML is the code that allows us to build websites
If you 'view the source', you see this
Photo credit: Nic's events cc
Photo credit: pumpkincat210 cc
Your Content+ HTML: Structure+ CSS: Presentation= Your Website
A website is a way to present your content to the world, using HTML and CSS to present that content & make it look good.
A paragraph is your content
<p>A paragraph is your content</p>
A paragraph is your content
<tagname>Stuff in the middle</tagname>
<p> This is a sample paragraph.</p>
<br/> <img/>
<p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p>
<p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p>
<p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p>
Paragraph 1
Paragraph 2
Paragraph 3
* You can add as much or as little space as you want in your code. It all looks the same!
<h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <h4>Heading 4</h4> <h5>Heading 5</h5> <h6>Heading 6</h6>
* Headings are for organization, not size
<p> Here is a paragraph with <em>Emphasized</em> text and <strong>Important</strong> text. </p>
Here is a paragraph with Emphasized text and Important text.
<ul> <li>List Item</li> <li>AnotherList Item</li> </ul>
<ol> <li>List Item</li> <li>AnotherList Item</li> </ol>
Unordered list (bullets)
Ordered list (sequence)
List Item AnotherList ItemAll elements "nest" inside one another
Nesting is what happens when you put other containing tags inside other containing tags. For example, you would put the <p> inside of the <body> tags. The <p> is now nested inside the <body>
Whichever element OPENS first CLOSES last
Elements are 'nested' inside the <body> tag.
<body> <p>A paragraph inside the body tag</p> </body>
Paragraphs 'nested' inside list items.
<ul> <li> <p>A paragraph inside a list item</p> </li> </ul>
Look at the code and find:
<div id="copyright">© Techgirlz 2015</div> <img src="my_picture.jpg" /> <a href="http://www.techgirlz.org/">Techgirlz</a>
Links have two components
<a href="http://www.techgirlz.org/">Techgirlz</a>
The <a> tag surrounds text or images to turn them into links
Links can have attributes that tell the link to do different things, like open in a new tab or launch your e-mail program.
<a href="http://google.com" target="_blank">Link Text</a>
Link opens in a new window/tab with target="_blank"
<a href="mailto:info@techgirlz.org">E-mail us!</a>
Link opens mail program by inserting mailto: directly before the email address.
Images have three components
<img src ="techgirlz-logo.png" alt = "Techgirlz Logo"/>
Relative paths change depending upon the page the link is on.
CSS = Cascading Style Sheets
CSS is a "style sheet language" that lets you style the elements on your page.
CSS is works in conjunction with HTML, but is not HTML itself.
All colored text, position, and size
selector { property: value; }
A block of CSS code is a rule.
The rule starts with a selector.
It has sets of properties and values.
A property-value pair is a declaration.
<!-- <link rel="stylesheet" href="style.css"> -->Take out the <!-- and --> so it looks like this:
<link rel="stylesheet" href="style.css">Save and reload the page. See how it changes!
As a general coding principle, Don't Repeat Yourself.
To reuse CSS, we use IDs and classes.
Photo credit: IronRodArt cc
The "#" is how you tell CSS "this is an id."
The "." is how you tell CSS "this is a class name."
Declarations: Property and value of style you plan use on HTML element.
Declarations end with a semicolon
Declaration groups are surrounded by curly brackets.
selector { property: value; property: value; property: value; }
p { property: value; }
Selects all paragraph elements.
img { property: value; }
Selects all image elements.
#footer { property: value; }
Selects all elements with an id of "footer".
<p id="footer">Copyright 2011</p>
The associated HTML.
.warning { color: red; }
Selects all elements with a class of "warning".
<p class="warning">Run away!</p>
The associated HTML.
p em { color: yellow; }
Selects all em elements that are within a paragraph
<p>This is <em>important.</em></p>
The associated HTML.
The color property changes the color of the text.
p { color: red; color: #ff0000; color: rgb(255, 0, 0); }
Color name
Hexadecimal value
RGB value
The 17 standard colors are: aqua, black, blue, fuchsia, gray, grey, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.
The background-color property changes the color of the background.
p { background-color: black; background-color: #000000; background-color: rgb(0,0,0); }
The background-image property lets you use an image as a background.
body { background-image: url("kitten.jpg"); }
The font-size property changes the size of the font.
p { font-size: 12px; font-size: 1.5em; font-size: 100%; }
Pixels
"em"
Percentage
This adds borders to elements
p { border: 4px solid black; }
Size
Style (solid, dashed, dotted, etc.)
Color