Wednesday, July 2, 2014

Media Queries for Devices


iPhone 4 
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {

} 
 
iPads (portrait and landscape)
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {

}

iPads (landscape)
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {

}

iPads (portrait)
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {

}
 
Smartphones (portrait and landscape) 
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {

}

Smartphones (landscape)
@media only screen 
and (min-width : 321px) {

}

Smartphones (portrait)
@media only screen 
and (max-width : 320px) {

}


Desktops and laptops
@media only screen 
and (min-width : 1224px) {

}

Large screens
@media only screen 
and (min-width : 1824px) {

}

Tuesday, July 1, 2014

HTML5 and CSS3 Notes for Interview


/*---JS------*/
Almost everything in JavaScript can be an Object: Strings, Functions, Arrays, Dates....

Objects are just data, with added properties and methods.




/*---DOM------*/
When a web page is loaded, the browser creates a Document Object Model of the page.

The HTML DOM model is constructed as a tree of Objects:
The HTML DOM is a standard for how to get, change, add, or delete HTML elements.


/*------unicode-----*/
ISO-8859-1 is the default character in HTML 4.01.
ISO (The International Standards Organization) defines the standard character sets for different alphabets/languages.

ASCII stands for the "American Standard Code for Information Interchange".
UTF-8 is the preferred encoding for e-mail and web pages
UTF-16 is used in major operating systems and environments, like Microsoft Windows, Java and .NET.

The Unicode Standard covers (almost) all the characters, punctuations, and symbols in the world.


/*-----HTML5--------*/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.

<!DOCTYPE html>
IE Compatibility modes
<meta http-equiv="X-UA-Compatible" content="IE=edge">

Semantic = Meaning.
Semantic elements = Elements with meaning.

    <header>
    <nav>
    <section>
    <article>
    <aside>
    <figure>
    <figcaption>
    <footer>
    <details>
    <summary>
    <mark>
    <time>


New input types:

    color
    date
    datetime
    datetime-local
    email
    month
    number
    range
    search
    tel
    time
    url
    week



New attributes for <form>:

    autocomplete
    novalidate

New attributes for <input>:
    autocomplete
    autofocus
    form
    formaction
    formenctype
    formmethod
    formnovalidate
    formtarget
    height and width
    list
    min and max
    multiple
    pattern (regexp)
    placeholder
    required
    step


New Elements in HTML5

<canvas>
audio
video
embed
source
track



css selectors

div p
div > p
ul + h3
ul ~ table
*
[id]
[id=my-Address]
[id$=ess]
[id|=my]
[id^=L]
[title~=beautiful]
[id*=s]
:checked
:disabled
:enabled
:empty
:focus
p:first-child
p::first-letter
p::first-line
p:first-of-type
h1:hover
input:in-range
input:out-of-range
input:invalid
input:valid
p:lang(it)
p:last-child
p:last-of-type
tr:nth-child(even)
tr:nth-child(odd)
li:nth-child(1)
li:nth-last-child(1)
li:nth-of-type(2)
li:nth-last-of-type(2)
b:only-child
h3:only-of-type
ul li:eq(0)
ul li:gt(0)
ul li:lt(2)
li:not(:eq(1))
:root



Specify two image paths and the @1x image dimensions, and Bootstrap will provide an @2x media query

.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
  background-image: url("@{file-1x}");

  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and (     -o-min-device-pixel-ratio: 2/1),
  only screen and (        min-device-pixel-ratio: 2),
  only screen and (                min-resolution: 192dpi),
  only screen and (                min-resolution: 2dppx) {
    background-image: url("@{file-2x}");
    background-size: @width-1x @height-1x;
  }
}

The DOM Programming Interface

HTML DOM methods are actions you can perform (on HTML Elements)
HTML DOM properties are values (of HTML Elements) that you can set or change
 
The HTML DOM can be accessed with JavaScript (and with other programming languages).
In the DOM, all HTML elements are defined as objects.
The programming interface is the properties and methods of each object.
A property is a value that you can get or set (like changing the content of an HTML element).
A method is an action you can do (like add or deleting an HTML element).




Prototype

The prototype property allows you to add properties and methods to an object
object.prototype.name=value


Properties

Properties are the values associated with a JavaScript object.
A JavaScript object is a collection of unordered properties.
Properties can usually be changed, added, and deleted, but some are read only.


JSON 

JSON: JavaScript Object Notation.
JSON is a syntax for storing and exchanging data.
JSON is an easier to use alternative to XML.

JSON Syntax Rules

JSON syntax is a subset of the JavaScript object notation syntax:

  • Data is in name/value pairs
  • Data is separated by commas
  • Curly braces hold objects
  • Square brackets hold arrays

Ex:- {"employees":[
    {"firstName":"John", "lastName":"Doe"},
    {"firstName":"Anna", "lastName":"Smith"},
    {"firstName":"Peter", "lastName":"Jones"}
]}