HTML Documents STRUCTURE
<!DOCTYPE html>
<html>
<head>
<title>My first page</
title >
</
head >
<body>
<p>This is my text</p>
</body>
</html>
All your code has to be beetween <html> tags (except DOCTYPE), and your document have to contain a <head> and a <body> tag.
the <head> tag
The <head> tag is used for page configuration (language, scripts, style, search engines...
Example:
<head>
<title>This is my page title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="javascript.js"/>
</head>
Some usefull tags
HTML5 tags:
<header> : this is a header from a page or a section
<article> : represent an article: blog entry, newspaper
<nav> : navigational section (menu)
<section> a section within an article
<aside> : surronding content, often used as side bar
OTHERS USEFULL TAGS
<div> : define a division or a section in a page
<img> : to display pics or image
<a> : this is a link
<h1> , <h2>, <h3>: titles
<table>: data tables
<ul>, <li>, <ol> : lists
tags USE
A HTML tag is always closed.
Two ways:
1/ <div>Lorem ipsum...</div>
<div><a href="http://google.fr">Google</a></div>
NB: The tags here contain something.
2/ <img src="toto.gif"/>
NB: the tag contains nothing, so no need to make a second tag to close this.
TIPS!
Almost all browsers include development tool (F12 for Chrome and Firefox)
The web is open source, millions of example are accessible with CTRL+U :)
CSS
What is it used for?
CSS is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the layout, colors, and fonts.
One ".html" for your content.
One ".css" file for the style.
CSS PROPERTIES EXAMPLES
.myTitles{
text-weight: bold;
font-size: 16px ;
}
p{
font-size: 12px ;
}
#banner{
border-width: 2px ;
border-color: red ;
}
CSS BASIC SELECTORS
It's used to determine on which html tags the style will be be applied.
You can select those by three different ways.
DOM TYPE
div{ .... } => The style will be applied for each <div> tags.
Example: <div>lorem ipsum</div>
BY CLASS
.myClass{ ... } => each elements of myClass
Example: <div class="myClass"> ... </div>
BY ID
#connectBox{ ... } => for the dom element with connectBox id
Example: <div id="connectBox">...</div>
MORE COMPLEX SELECTOR
The selection can be more precise by adding or/and mixing selectors
Example:
div.myClass {...} : will be applied to all <div> tag with the class myClass => <div class="myClass">
#connectBox li{...} : will be applied to all list element contained in the connectBox
#connectBox li a{...} : will be applied to each link in lists contained in the connectBox
PSEUDO selector
Those can be usefull sometimes.
Example:
div>p:first-of-type { ... }
This selector matches the first p element that’s a child of a div element. o
Example
The following rule set will be applied to elements whose language specification is "fr" (French)
lang(fr) { ... }