- HTML 4.01 in 1999 …….HTML 5 in 2012.
- HTML specifies the CONTENT of the webpages.
→ CSS specifies the LAYOUT of the web pages.
→ JS specifies the BEHAVIOUR of web pages.
- HTML headings are defined with the
- NOT an HTML tag.
- It is an information ( a declaration) to the browser about what version the HTML is written in.
<!DOCTYPE>declaration represents the document type, and helps browsers to display web pages correctly.
- It must only appear once, at the top of the page (before any HTML tags).
<!DOCTYPE>declaration is NOT case sensitive.
<!DOCTYPE>declaration for HTML5 is:
_blank => Opens the linked document in a new window or tab
_self= > Opens the linked document in the same frame as it was clicked (this is default)
_parent=> Opens the linked document in the parent frame
_top=> Opens the linked document in the full body of the window
attribute=”_blank” in html hyperlink => tells the browser to open a new window (or tab, if that’s the user’s preference) when that link is clicked.
- provides metadata about the document.
- <meta> tag goes inside the HEAD element.
- is NOT displayed on the page, but is machine readable.
- is used by Search engines for SEO purposes.
- used to specify page description, keywords, author of the document, last modified, etc.
HTLM 5 APIs
- Application Cache
- Drag & Drop
- Local Storage
- Server-Sent Events
Why HTML 5 over HTML 4.01
- 8 more semantic elements introduced
- <audio> <video> for media playback.
- <canvas> for 2D drawing.
- support for local Storage.
- Reduced the need for external plugins (like Flash)
- Better Error Handling
- Local SQL Database Support
- More Markup to replace scripting.
Block vs Inline
- block arranges elements within a page flow vertically ( from top to bottom).
- an element that takes up the full width available & has a line-break before & after it.
- <div> <p> <h1> <li>
- block arranges elements within a page flow horizontally( from left to right).
- an inline element ONLY takes up as much width as necessary and doesn’t force line-breaks;
- <span> <a>
Positioning ( f A R S I ) in HTML
To start with, create a parent container with 4 boxes side by side.
<div class=”box” id=”one”>One</div>
<div class=”box” id=”two”>Two</div>
<div class=”box” id=”three”>Three</div>
<div class=”box” id=”four”>Four</div>
border: 2px black dotted;
Live code: JsBin
By default, position is set to static. It positions based on the layout in the flow.
What happens when we want to move the GreenBox but do not want to affect the layout around it?
This is where
position: relative comes in. Move the green box relative to its current position to 20px from the left and top without changing the layout around it. Thus, leaving a gap for the green box where it would have been had it not been position.
Live code: JsBin
Position: absolute is the opposite.
position: absolute to the GreenBox, it will not leave any gap where it would have been. The position of the GreenBox is based on its parent position (the dotted border). Thus, moving 20px to the left and bottom from the top-left origin of the dotted border.
Live code: JsBin
In a nutshell …
position: relativeplaces an element relative to its current position without changing the layout around it, whereas
position: absoluteplaces an element relative to its parent’s position and changing the layout around it.
- place your absolute positioned elements inside position:relative container so that ur absolute positioned element is relative to that relative positioned element else your element will fly.
HTML5 for the mobile web — forms and input types
The full list of input types which are particularly useful for mobile users is:
Input type tel vs Input type number
The tel input type is very similar to the number input type. The main difference is in the numeric keypad that is displayed on some browsers.
For number a simple numeric keypad is shown, but for tel the user is presented with a virtual telephone keypad, complete with alphanumeric keys.
HTML vs HAML
- Technically speaking key differences are: Haml doesn’t have both start and end for each element like eRuby. eRuby syntax looks a lot like HTML and is thereby more HTML-like while Haml is more CSS-like. Haml uses indentation to nest tag elements whereas eRuby uses the same HTML representation.
- On Stackoverflow — HTML has 65k followers. You WILL get an answer, most likely many answers, in a very short amount of time. HAML has 157 followers. Simple math.