HTML Css Javascript
HTML Css Javascript
HTML Css Javascript
Introduction of HTML/CSS/JS
What is HTML?
●HTML is a language for describing web pages.
●HTML stands for Hyper Text Markup Language
●HTML is a markup language
●A markup language is a set of markup tags
●The tags describe document content
●HTML documents contain HTML tags and plain text
●HTML documents are also called web pages
HTML Tags
●HTML tags are keywords (tag names) surrounded by angle brackets like <html>
●The first tag in a pair is the start tag, the second tag is the end tag
●The end tag is written like the start tag, with a forward slash before the tag name
●Start and end tags are also called opening tags and closing
tags<tagname>content</tagname>
• Basic HTML page structure
• HTML comments are not displayed in the browser, but they can help document your HTML
source code.
HTML Links
• HTML links are hyperlinks. You can click on a link and jump to another document.
Syntax :
• An inline element does not start on a new line & only takes up as much width as necessary.
HTML Classes And Id
▪Internal Style Sheet: An internal style sheet should be used when a single
document has a unique style.
<head>
<style>
p {margin-left:20px;}
body{background-image:url("images/back40.gif");
}
</style>
</head>
• Inline Styles: To use inline styles use the style attribute in the
relevant tag. The style attribute can contain any CSS property.
{
color: #009900;
font-family: Georgia, sans-serif;
}
The id Selector
Syntax
#selector-id {
property : value ;
}
The class Selector
The class selector is used to specify
a style for a group of elements. The class
selector uses the HTML class attribute,
and is defined with a "."
Syntax
.selector-class
{
property : value ;
}
CSS Anchors, Links and Pseudo Classes:
●All HTML elements can be considered as boxes. In CSS, the term "box model" is
used when talking about design and layout.
●The CSS box model is essentially a box that wraps around HTML elements, and it
consists of: margins, borders, padding, and the actual content.
●The box model allows to place a border around elements and space elements in
relation to other elements.
Click to add text
Example
z What is JavaScript
The <script> Tag To insert a JavaScript into an HTML page, use the <script> tag.
The <script> and </script> tells where the JavaScript starts and ends.
<script>
alert("My First JavaScript");
</script>
JavaScript in<body>
<html>
<body>
<script>
document.write("<h1>This is a heading</h1>");
</script>
</body>
</html>
External JavaScripts
Scripts can also be placed in external files. External files often contain code to be used by
several different web pages. External JavaScript files have the file extension .js.To use an
external script, point to the .js file in the "src" attribute of the <script> tag:
<html>
<body>
<script src="myScript.js">
</script>
</body>
</html>
z The HTML DOM (Document Object Model)
• document.getElementById("<id-name>");
• document.getElementsByTagName("<tag>");
• document.getElementsByName(“<name-attr>”);
• document.getElementByClass(“<class-name>”);
Writing Into HTML Output
• document.write("<h1>This is a heading</h1>");
• document.write("<p>This is a paragraph</p>");
Reacting to Events
Validate Input