Introduction HTML and CSS
Introduction HTML and CSS
HTML stands for Hyper Text Markup Language that describes the
structure of Web pages using markup.
HTML elements are the building blocks of pages.
Element describe to the browser how a particular piece of text should be
treated.
HTML Elements are expressed as tags or tags are element names
surrounded by angle brackets.
Attributes specify additional information for tags.
Document Basic Structure
<!DOCTYPE html>
<html>
<head>
<title>page</title>
</head>
<body>
</body>
</html>
Basic Tags
<!DOCTYPE> Defines the document type
<html>... </html> Defines an HTML document
<title>... </title> Defines a title for the document
<body>....</body> Defines the document's body
<h1>...</h1> Defines HTML headings i.e h1 to h6
<p>....</p> Defines a paragraph
<br> Inserts a single line break
<hr> Defines a thematic change in the content
<!--...--> Defines a comment
<head>...</head> Defines information about the document
<meta> Defines metadata about an HTML document
<style>... </style> Defines style information for a document
<script>... </script> Defines a client-side script
Text Tags
<b>...</b> for bold text
<i>...</i> for Italic Text
<u>...</u> for Underlined Text
<strike>...</strike> for strike Text
<sup>...</sup> for Superscript Text
<sub>...</sub> for Subscript Text
<ins>...</ins> for Inserted Text
<del>...</del> for Deleted Text
<small>...</small> for Smaller Text
<blockquote>... </blockquote> for quoted Text
<em> ... </em> for emphasized text
<strong>... </strong> for important text
<div>...</div> Defines a division or a section in an HTML document.
<span>..</span> Defines a section in a document
CSS
CSS is the language that defines the presentation of a web page. It is used
to add color, background images, and textures, and to arrange elements on
the page. However, CSS does a lot more than just paint a picture. It is also
used to enhance the usability of a web site or application.
CSS
CSS stands for Cascading Style Sheets and it is the language used to style
the visual presentation of web pages.
CSS is the language that tells web browsers how to render the different parts
of a web page.
Every item or element on a web page is part of a document written in a
markup language.
A selector is a code snippet used to identify the web page element or
elements that are to be affected by the styles.
A property is the aspect of the element that is to be affected. For example,
color, padding, margin, and background are CSS properties.
A value is used to define a property. For example color:red;
The combination of a property and a value is called a declaration.
A declaration block is the term used to refer to all of the declarations applied
to a single selector.
A single selector and the declaration block that follows it in combination are
referred to as a ruleset.
Linking CSS Rules to HTML Document
Inline styles are applied to specific HTML elements. The HTML attribute
style is used to define rules that only apply to that specific element
<h1 style="color:red; padding:10px; text-decoration:underline;">
Example Heading</h1>
Internal stylesheet is a block of CSS added to an HTML document Head
element and all CSS declarations are added between the style tags.
<head> <style>
h1 { color: red; padding: 10px; text-decoration: underline; }
</style> </head>
External stylesheets are documents containing CSS statements. The rules
defined in the document are linked to one or more HTML documents by
using the link tag within the head tag of document.
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
CSS Selector
CSS supports a rich set of selectors for specifying to which particular
element(s) a CSS rule applies.
CSS initially supported basic selectors to indicate a particular tag, group of
tags, or position in the document tree.
#id selector styles the element with the specified id.
#id {
css declarations;
}
element selector selects all elements with the specified element name.
element {
css declarations;
}
.class selector selects elements with a specific class attribute.
.class {
css declarations;
}
CSS:Text Formation
Color: red | #ff0000 | rgb(255,0,0) // set the color of the text
text-align: center |left |right | justify //set the horizontal alignment
text-decoration: overline | line-through| underline| none
text-transform: uppercase lowercase capitalize
text-indent: 50px; //set indentation of the first line of a text
letter-spacing: 3px | -4px //set space between letters.
line-height: 0.8 | 1.8 //set space between lines.
direction: rtl // change the direction of text
word-spacing: 10px| -5px //set space between words.
vertical-align: baseline|length|sub|super|top|text-top |middle |
bottom |text- bottom|initial|
CSS:Text Formation
text-shadow: h-shadow v-shadow blur-radius color|none|initial
text-shadow: 3px 2px red;