HTML Theory-1
HTML Theory-1
What is HTML?
HTML stands for Hyper Text Markup Language
HTML is the standard markup language for creating Web pages
HTML describes the structure of a Web page
HTML consists of a series of elements
<h1>Creative</h1>
<p>My first Practicle</p>
</body>
</html>
Example Explained
The <!DOCTYPE html> declaration defines that this document is an
HTML5 document
The <html> element is the root element of an HTML page
The <head> element contains meta information about the HTML page
The <title> element specifies a title for the HTML page (which is
shown in the browser's title bar or in the page's tab)
The <body> element defines the document's body, and is a container
for all the visible contents, such as headings, paragraphs, images,
hyperlinks, tables, lists, etc.
<tagname>Demo...</tagname>
Mo:9377097697
Creative Design & Multimedia Institute
HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE
html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.
HTML Editors
1.Notepad
2. Sublime
3. Notepad++
4. Atom
5. Vim
Mo:9377097697
Creative Design & Multimedia Institute
Basic HTML
Formatting Tag List
Mo:9377097697
Creative Design & Multimedia Institute
The <br> tag defines a line break, and is an empty element without a closing
tag:
HTML Attributes
All HTML elements can have attributes
Attributes provide additional information about elements
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
Images
<img src="pic_trulli.jpg" alt="Demo" width="100px" height="100px"
title="demo" border="5px">
Mo:9377097697
Creative Design & Multimedia Institute
Output:
Mo:9377097697
Creative Design & Multimedia Institute
Example
<p>WWF's goal is to: <q>Build a future where people live in harmony
with nature.</q></p>
Example
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> was founded
in 1948.</p>
Example
<address>
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
Example
<p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p>
Mo:9377097697
Creative Design & Multimedia Institute
Example:
<bdo dir="rtl">This text will be written from right to left</bdo>
HTML Comments
<!-- Write your comments here -->
When you move the mouse over a link, the mouse arrow will turn into a little
hand.
NOTE
HTML Images
he HTML <img> tag is used to embed an image in a web page.
Images are not technically inserted into a web page; images are linked to
web pages. The <img> tag creates a holding space for the referenced image.
Mo:9377097697
Creative Design & Multimedia Institute
Definition
1. The accesskey attribute specifies a shortcut key to activate/focus an
element.
Mo:9377097697
Creative Design & Multimedia Institute
Definition
The <ol> tag defines an ordered list. An ordered list can be numerical
or alphabetical.
Attributes
Mo:9377097697
Creative Design & Multimedia Institute
HTML Input
<input type="button">
<input type="checkbox">
<input type="color">
<input type="date">
<input type="datetime-local">
<input type="email">
<input type="file">
<input type="hidden">
<input type="image">
<input type="month">
<input type="number">
<input type="password">
<input type="radio">
<input type="range">
<input type="reset">
<input type="search">
<input type="submit">
<input type="tel">
<input type="text">
<input type="time">
<input type="url">
<input type="week">
Mo:9377097697
Creative Design & Multimedia Institute
The multiple attribute works with the following input types: email, and file.
Mo:9377097697
Creative Design & Multimedia Institute
The <canvas> element is only a container for graphics. You must use
JavaScript to actually draw the graphics.
Canvas has several methods for drawing paths, boxes, circles, text, and
adding images.
Example:
<canvas width="200" height="100" style="border:1px solid red;">
Mo:9377097697
Creative Design & Multimedia Institute
What is SVG?
SVG stands for Scalable Vector Graphics
SVG is used to define graphics for the Web
SVG is a W3C recommendation
SVG has several methods for drawing paths, boxes, circles, text, and graphic
images.
Exmaple:
<svg width="100" height="100">
<circle cx="50" cy="50" fill="yellow" r="40" stroke-
width="4" stroke="green" />
</svg>
NOTE: Code explanation: The cx and cy attributes define the x and y coordinates of the
center of the circle. If cx and cy are omitted, the circle's center is set to (0,0) The
r attribute defines the radius of the circle.
SVG Rectangle
<svg width="400" height="100">
<rect width="400" height="100" style="fill:red; stroke-width:10;
stroke:rgb(0,78,255)" />
</svg>
Mo:9377097697
Creative Design & Multimedia Institute
HTML Multimedia
What is Multimedia?
Multimedia comes in many different formats. It can be almost anything you
can hear or see, like images, music, sound, videos, records, films,
animations, and more.
HTML Video
The HTML <video> element is used to show a video on a web page.
Example:
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
</video>
Attributes
Attribute Description
Autoplay Specifies that the video will start playing as soon as it
is ready
Controls Specifies that video controls should be displayed (such
as a play/pause button etc).
Height Sets the height of the video player
Loop Specifies that the video will start over again, every
time it is finished
Muted Specifies that the audio output of the video should be
muted
Poster Specifies an image to be shown while the video is
downloading, or until the user hits the play button
Preload if and how the author thinks the video should be
loaded when the page loads
Src the URL of the video file
Width Sets the width of the video player
Mo:9377097697
Creative Design & Multimedia Institute
What Is CSS?
CSS stands for Cascading Style Sheets
CSS describes how HTML elements are to be displayed on screen,
paper, or in other media
CSS saves a lot of work. It can control the layout of multiple web
pages all at once
External stylesheets are stored in CSS files
CSS Syntax
Mo:9377097697
Creative Design & Multimedia Institute
External CSS
Internal CSS
Inline CSS
CSS METHORD
1.TAG
2. CLASS
3. #ID
4. @MEDIA
Mo:9377097697
Creative Design & Multimedia Institute
CSS Backgrounds
background-color: green;
background: rgba(0, 128, 0, 0.3)
background-image: url("gradient_bg.png");
background-repeat: repeat-x;
Mo:9377097697
Creative Design & Multimedia Institute
CSS Margins
The CSS margin properties are used to create space around elements,
outside of any defined borders.
CSS Padding
Mo:9377097697
Creative Design & Multimedia Institute
The CSS padding properties are used to generate space around an element's
content, inside of any defined borders.
CSS Outline
An outline is a line that is drawn around elements, OUTSIDE the borders, to
make the element "stand out".
Mo:9377097697
Creative Design & Multimedia Institute
Text Alignment
The text-align property is used to set the horizontal alignment of a
text.
text-align: center;
text-align: left;
text-align: right;
text-align: justify;
Text Direction
The direction and unicode-bidi properties can be used to change the text
direction of an element:
Example:
p.ex1 {
direction: rtl;
unicode-bidi: bidi-override;
Mo:9377097697
Creative Design & Multimedia Institute
Vertical Alignment
The vertical-align property sets the vertical alignment of an element.
Example:
img.top {
vertical-align: top;
}
Opacity
opacity property specifies the opacity/transparency of an element. It
can take a value from 0.0 - 1.0. The lower value, the more
transparent:
Example : opacity : 0.5;
display Property
Mo:9377097697
Creative Design & Multimedia Institute
display: none;
display: inline;
display: block;
display: inline-block
Text Decoration
The text-decoration property is used to set or remove decorations from
text.
Example:
text-decoration: none;
text-decoration: overline;
text-decoration: line-through;
text-decoration: underline;
Text Transformation
The text-transform property is used to specify uppercase and lowercase
letters in a text.
Example :
text-transform: uppercase;
text-transform: lowercase;
text-transform: capitalize;
text-shadow: 2px 2px 5px red;
Mo:9377097697
Creative Design & Multimedia Institute
font-size:10vw
The following example selects all <a> elements with a target attribute:
Example:
a[target] {
background-color: yellow;
}
Mo:9377097697
Creative Design & Multimedia Institute
Example :
CSS
a[target=_blank] {
background-color: yellow;
HTML
Google Fonts
If you do not want to use any of the standard fonts in HTML, you can use
Google Fonts.
Sibling elements must have the same parent element, and "adjacent" means
"immediately following".
The following example selects the first <anytag> element that are placed
immediately after <div> elements:
Example:
Mo:9377097697
Creative Design & Multimedia Institute
div + p {
background-color: yellow;
}
Example :
div ~ p {
background-color: yellow;
}
The following example selects all <p> elements that are siblings of <div>
elements:
Pseudo-elements
What are Pseudo-Elements?
A CSS pseudo-element is used to style specified parts of an element.
For example
Example:
p::first-line {
color: #ff0000;
font-variant: small-caps;
}
Mo:9377097697
Creative Design & Multimedia Institute
The following example formats the first letter of the text in all <p> elements:
Example:
p::first-letter {
color: #ff0000;
font-size: xx-large;
}
Multiple Pseudo-elements
In the following example, the first letter of a paragraph will be red, in an xx-
large font size. The rest of the first line will be blue, and in small-caps. The
rest of the paragraph will be the default font size and color:
Example:
p::first-letter {
color: #ff0000;
font-size: xx-large;
}
p::first-line {
color: #0000ff;
font-variant: small-caps;
}
Mo:9377097697
Creative Design & Multimedia Institute
h1::before {
content: url(smiley.gif);
}
Example:
h1::after {
content: url(smiley.gif);
}
Example:
::selection {
color: red;
background: yellow;
}
Mo:9377097697
Creative Design & Multimedia Institute
flex Property
Example:
parent:
display: flex;
child:
flex:1
Output:
Flex, flex-wrap
Example:
parent:
display: flex;
flex-wrap: wrap
child:
flex: 50%;
Output
column-count Property
column-count:5
column-gap: 0px;
Mo:9377097697
Creative Design & Multimedia Institute
column-rule: 10px solid red; // for border color
column-rule-style: outset;
column-rule-width: 5px;
cursor Property
cursor: alias;
.all-scroll {cursor: all-scroll
cursor: auto
cursor: cell
cursor: context-menu
cursor: col-resize
cursor: copy
cursor: crosshair
cursor: default
cursor: e-resize
cursor: ew-resize
cursor: grab
cursor: grabbing
cursor: help
cursor: move
cursor: n-resize
cursor: ne-resize
cursor: nesw-resize
cursor: ns-resize
cursor: nw-resize
cursor: nwse-resize
cursor: no-drop
cursor: none
cursor: not-allowed
cursor: pointer
cursor: progress
Mo:9377097697
Creative Design & Multimedia Institute
cursor: row-resize
cursor: s-resize
cursor: se-resize
cursor: sw-resize
cursor: text
cursor: w-resize
cursor: wait
cursor: zoom-in
cursor: zoom-out
empty-cells Property
empty-cells: hide;
filter Property
filter: grayscale(100%);
Mo:9377097697
Creative Design & Multimedia Institute
font-size: 15px;
font-style: oblique;
font-variant: small-caps;
font-variant-caps: petite-caps;
font-weight: bold;
grid Property
display: grid;
grid: 150px / auto auto auto;
grid-gap: 10px;
display: inline-grid;
grid-column-gap: 50px;
grid-template-columns: auto auto auto;
grid-row-gap: 50px;
grid-gap: 50px 100px;
grid-template-rows: 80px 200px 150px;
Example:
Mo:9377097697
Creative Design & Multimedia Institute
CSS Dropdowns
Create a dropdown box that appears when the user moves the mouse
over an element.
Image Sprites
Instead of using Multi Images separate images, we use this single image
Mo:9377097697
Creative Design & Multimedia Institute
CSS Counters
CSS counters are "variables" maintained by CSS whose values can be
incremented by CSS rules (to track how many times they are used). Counters let
you adjust the appearance of content based on its placement in the document.
Example :
body {
counter-reset: section;
p::before{
counter-increment: section;
//background-color: red;
Mo:9377097697
Creative Design & Multimedia Institute
Example :
.class{
position: relative;
animation: abc 5s infinite;
}
@keyframes abc {
from {left: 0px;}
to {left: 200px;}
}
animation-delay Property
The animation-delay value is defined in seconds (s) or milliseconds (ms).
Example : div {
width: 50px;
height: 50px;
background: red;
position: relative;
animation: abc 5s infinite;
animation-delay: 2s;
}
@keyframes abc {
from {left: 0px;}
Mo:9377097697
Creative Design & Multimedia Institute
to {left: 300px;}
}
animation-direction Property
Mo:9377097697