HTML
HTML
<tagname>content</tagname>
<h1>My First Heading</h1>
<h2>My First Heading</h2>
<h3>My First Heading</h3>
<h4>My First Heading</h4>
<h5>My First Heading</h5>
<p>My first paragraph.</p>
<p><em>This text is emphasized</em>.</p> #Defines emphasized text
<h2>HTML <small>Small</small> Formatting</h2> # Defines smaller text
<h2>HTML <mark>Marked</mark> Formatting</h2># Defines marked/highlighted text
<p>This is <sup>superscripted</sup> text.</p># Defines superscripted text
<p><i>This text is italic</i>.</p> # Defines italic text
<p><strong>This text is strong</strong>.</p># Defines important text
<p>WWF's goal is to: <q>Build a future where people live in harmony with nature.</q></p># Defines a
short inline quotation
<blockquote cite="http://www.worldwildlife.org/who/index.html">#Defines a section that is quoted from
another source
For 50 years, WWF has been protecting the future of nature.</blockquote>
<p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p># Defines an
abbreviation or acronym
<address> #Defines contact information for the author/owner of a document
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
<bdo dir="rtl">This text will be written from right to left</bdo># Defines the text direction
<p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p> Defines the title of a work
<ul> #
<li>Coffee</li> # point
<li>Tea</li>
<li>Milk</li>
</ul>
<form action="action_page.php">
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
<input type="password" name="psw">
<input type="number" name="quantity" min="1" max="5">
<input type="date" name="bday" min="2000-01-02"><br>
<input type="range" name="points" min="0" max="10">
<input type="month" name="bdaymonth"> <input type="week" name="week_year"> <input type="time"
name="usr_time"> <input type="datetime" name="bdaytime"> <input type="datetime-local"
name="bdaytime"> <input type="email" name="email"> <input type="search" name="googlesearch">
<input type="tel" name="usrtel">v
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
<input type="checkbox" name="vehicle1" value="Bike"> I have a bike<br>
<input type="checkbox" name="vehicle2" value="Car"> I have a car
<input type="submit" value="Submit">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected >Fiat</option>
<option value="audi">Audi</option>
</select>
CSS:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head> # link html to .css
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page
Borders:
Margins:
margin A shorthand property for setting the margin properties in one declaration
Padding:
padding A shorthand property for setting all the padding properties in one declaration
Outline:
outline-offset Specifies the space between an outline and the edge or border of an element
Text:
letter-
Increases or decreases the space between characters in a text
spacing
text-
Specifies the decoration added to text
decoration
text-
Controls the capitalization of text
transform
Used together with the direction property to set or return whether the text should be
unicode-bidi
overridden to support multiple languages in the same document
vertical-
Sets the vertical alignment of an element
align
Fonts:
Times New
Serif Roman Serif fonts have small lines at the ends on some characters
Georgia
Sans- Arial "Sans" means without - these fonts do not have the lines at the ends of
serif Verdana characters
Courier New
Monospace All monospace characters have the same width
Lucida Console
Link:
a:link {color: red;} /* unvisited link */
list-style- Specifies if the list-item markers should appear inside or outside the content
position flow
Table:
empty-cells Specifies whether or not to display borders and background on empty cells in a table
Visibility:
Specifies how an element should be displayed
display
a {display: block;}
bootstrap:
Method 1: <link rel="stylesheet" type="text/css" href="css1.css" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></scrip
t>
<script
src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></scri
pt>
Method 2:
1-Include bootstrap folders
2-<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<h1>Hello, world!</h1>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></scrip
t> <script src="js/bootstrap.min.js"></script> </body> </html>
Jquery:
Get started:
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></scrip
t>
<script type="text/javascript" src="js/jquery.js"></script>
$("p").hide();
$("p").show();
$("p").toggle();
$("#div1").fadeIn();
$("#div2").fadeIn("slow");
$("#div3").fadeIn(3000);
$("#div1").fadeOut();
$("#div2").fadeOut("slow");
$("#div3").fadeOut(3000);
$("#div1").fadeToggle();
$("#div2").fadeToggle("slow");
$("#div3").fadeToggle(3000);
$("#div1").fadeTo("slow", 0.15);
$("#div2").fadeTo("slow", 0.4);
$("#div3").fadeTo("slow", 0.7);
$("#panel").slideDown();
$("#panel").slideUp();
$("#panel").slideToggle();
$("div").animate({left: '250px'});
$("div").animate({left: '250px',opacity: '0.5',height: '150px',width: '150px'
});
$("div").animate({ height: 'toggle'});
$("button").click(function(){
var div = $("div");
div.animate({height: '300px', opacity: '0.4'}, "slow");
div.animate({width: '300px', opacity: '0.8'}, "slow");
div.animate({height: '100px', opacity: '0.4'}, "slow");
div.animate({width: '100px', opacity: '0.8'}, "slow");
});
$("#panel").stop();
$("#p1").css("color", "red").slideUp(2000).slideDown(2000);
.val()
.text()
.html()
.attr("href")
").append("Some appended text.");
$("p").prepend("Some prepended text.");
$("img").after("Some text after");
:first-child $("p:first-child") All <p> elements that are the first child of their pare
:first-of-type $("p:first-of-type") All <p> elements that are the first <p> element of t
parent
:last-child $("p:last-child") All <p> elements that are the last child of their pare
:last-of-type $("p:last-of-type") All <p> elements that are the last <p> element of t
parent
:nth-child(n) $("p:nth-child(2)") All <p> elements that are the 2nd child of their pare
:nth-last-child(n) $("p:nth-last-child(2)") All <p> elements that are the 2nd child of their pare
counting from the last child
:nth-of-type(n) $("p:nth-of-type(2)") All <p> elements that are the 2nd <p> element of t
parent
:nth-last-of-type(n) $("p:nth-last-of-type(2)") All <p> elements that are the 2nd <p> element of t
parent, counting from the last child
:only-child $("p:only-child") All <p> elements that are the only child of their par
:only-of-type $("p:only-of-type") All <p> elements that are the only child, of its type,
parent
parent > child $("div > p") All <p> elements that are a direct child of a <div> e
parent descendant $("div p") All <p> elements that are descendants of a <div> e
element + next $("div + p") The <p> element that are next to each <div> eleme
element ~ siblings $("div ~ p") All <p> elements that are siblings of a <div> eleme
:eq(index) $("ul li:eq(3)") The fourth element in a list (index starts at 0)
[attribute=value] $("[href='default.htm']") All elements with a href attribute value equal to "de
[attribute!=value] $("[href!='default.htm']") All elements with a href attribute value not equal to
"default.htm"
[attribute$=value] $("[href$='.jpg']") All elements with a href attribute value ending with
[attribute|=value] $("[title|='Tomorrow']") All elements with a title attribute value equal to 'Tom
or starting with 'Tomorrow' followed by a hyphen
[attribute^=value] $("[title^='Tom']") All elements with a title attribute value starting with
Events
event.currentTarget The current DOM element within the event bubbling phase
event.namespace Returns the namespace specified when the event was triggere
event.pageX Returns the mouse position relative to the left edge of the doc
event.pageY Returns the mouse position relative to the top edge of the doc
event.stopPropagation() Prevents the event from bubbling up the DOM tree, preventing
parent handlers from being notified of the event
event.which Returns which keyboard key or mouse button was pressed for
$.proxy() Takes an existing function and returns a new one with a partic
context
triggerHandler() Triggers all functions bound to a specified event for the selecte
elements
Effects
Method Description
clearQueue() Removes all remaining queued functions from the selected elements
delay() Sets a delay for all queued functions on the selected elements
dequeue() Removes the next function from the queue, and then executes the function
finish() Stops, removes and completes all queued animations for the selected elements
stop() Stops the currently running animation for the selected elements
Method Description
css() Sets or returns one or more style properties for selected elements
empty() Removes all child nodes and content from selected elements
hasClass() Checks if any of the selected elements have a specified class name
innerHeight() Returns the height of an element (includes padding, but not border)
innerWidth() Returns the width of an element (includes padding, but not border)
offset() Sets or returns the offset coordinates for selected elements (relative to the docum
toggleClass() Toggles between adding/removing one or more classes from selected elements
val() Sets or returns the value attribute of the selected elements (for form elements)
Method Description
$.ajaxPrefilter() Handle custom Ajax options or modify existing options before each request is sen
before they are processed by $.ajax()
$.ajaxTransport() Creates an object that handles the actual transmission of Ajax data
$.get() Loads data from a server using an AJAX HTTP GET request
$.getJSON() Loads JSON-encoded data from a server using a HTTP GET request
$.getScript() Loads (and executes) a JavaScript from a server using an AJAX HTTP GET reques
$.param() Creates a serialized representation of an array or object (can be used as URL que
for AJAX requests)
$.post() Loads data from a server using an AJAX HTTP POST request
ajaxError() Specifies a function to run when the AJAX request completes with an error
ajaxSend() Specifies a function to run before the AJAX request is sent
ajaxStart() Specifies a function to run when the first AJAX request begins
ajaxStop() Specifies a function to run when all AJAX requests have completed
load() Loads data from a server and puts the returned data into the selected element
$.post("demo_test_post.asp",
{
name: "Donald Duck",
city: "Duckburg"
},
function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});