0% found this document useful (0 votes)
13 views

What is HTML-1

HTML, or Hyper Text Markup Language, is the standard markup language for creating web pages and describes their structure through a series of elements that instruct the browser on how to display content. A simple HTML document includes elements such as <html>, <head>, <title>, and <body>, which define the page's structure and content. Additionally, HTML elements can have attributes that provide further information, and various formatting and styling options are available to enhance the presentation of the content.

Uploaded by

diwakardawn27
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

What is HTML-1

HTML, or Hyper Text Markup Language, is the standard markup language for creating web pages and describes their structure through a series of elements that instruct the browser on how to display content. A simple HTML document includes elements such as <html>, <head>, <title>, and <body>, which define the page's structure and content. Additionally, HTML elements can have attributes that provide further information, and various formatting and styling options are available to enhance the presentation of the content.

Uploaded by

diwakardawn27
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 90

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
 HTML elements tell the browser how to display the content
 HTML elements label pieces of content such as "this is a heading", "this
is a paragraph", "this is a link", etc.

A Simple HTML Document


Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>
<b>hi h ru </b>
<i> hi what doing</i>
<u>www.google.com</u>

</body>
</html>
Try it Yourself »

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.
 The <h1> element defines a large heading
 The <p> element defines a paragraph
What is an HTML Element?
An HTML element is defined by a start tag, some content, and an end tag:

<tagname> Content goes here... </tagname>


The HTML element is everything from the start tag to the end tag:

<h1>My First Heading</h1>


<p>My first paragraph.</p>

Start tag Element content End tag

<h1> My First Heading </h1>

<p> My first paragraph. </p>

<br> None none

HTML Page Structure


Below is a visualization of an HTML page structure:

<html>
<head>
<title>Page title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>

Step 1: Open Notepad (PC)


Windows 8 or later:

Open the Start Screen (the window symbol at the bottom left on your
screen). Type Notepad.

Windows 7 or earlier:

Open Start > Programs > Accessories > Notepad

Step 1: Open TextEdit (Mac)


Open Finder > Applications > TextEdit

Also change some preferences to get the application to save files


correctly. In Preferences > Format > choose "Plain Text"

Then under "Open and Save", check the box that says "Display HTML files as
HTML code instead of formatted text".

Then open a new document to place the code.

Step 2: Write Some HTML


Write or copy the following HTML code into Notepad:

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>


</body>
</html>

<!DOCTYPE html>

<html>

<body>

<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<h3>This is heading 3</h3>

<h4>This is heading 4</h4>

<h5>This is heading 5</h5>

<h6>This is heading 6</h6>

</body>

</html>

HTML Elements
The HTML element is everything from the start tag to the end tag:

<tagname>Content goes here...</tagname>


Examples of some HTML elements:

<h1>My First Heading</h1>


<p>My first paragraph.</p>

Start tag Element content End tag

<h1> My First Heading </h1>


<p> My first paragraph. </p>

<br> none none

Nested html

<!DOCTYPE html>

<html>

<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>

</html>

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"

The href Attribute


<!DOCTYPE html>

<html>

<body>
<h2>The href Attribute</h2>

<p>HTML links are defined with the a tag. The link address is specified in the href attribute:</p>

<a href="https://www.w3schools.com">Visit W3Schools</a>

</body>

</html>

<!DOCTYPE html>

<html>

<body>

<h2>The src Attribute</h2>

<p>HTML images are defined with the img tag, and the filename of the image source is specified in
the src attribute:</p>

<img src="img_girl.jpg" width="500" height="600">

</body>

</html>

There are two ways to specify the URL in the src attribute:

1. Absolute URL - Links to an external image that is hosted on another


website. Example: src="https://www.w3schools.com/images/img_girl.jpg".

Notes: External images might be under copyright. If you do not get


permission to use it, you may be in violation of copyright laws. In addition,
you cannot control external images; it can suddenly be removed or changed.

2. Relative URL - Links to an image that is hosted within the website. Here,
the URL does not include the domain name. If the URL begins without a slash,
it will be relative to the current page. Example: src="img_girl.jpg". If the URL
begins with a slash, it will be relative to the domain. Example:
src="/images/img_girl.jpg".

Paragraph

<!DOCTYPE html>

<html>

<body>

<p>

This paragraph

contains a lot of lines

in the source code,

but the browser

ignores it.

</p>

<p>

This paragraph

contains a lot of spaces

in the source code,

but the browser

ignores it.

</p>

<p>

The number of lines in a paragraph depends on the size of the browser window. If you resize the
browser window, the number of lines in this paragraph will change.

</p>

</body>
</html>

Html styles

<!DOCTYPE html>

<html>

<body>

<p>I am normal</p>

<p style="color:red;">I am red</p>

<p style="color:blue;">I am blue</p>

<p style="font-size:50px;">I am big</p>

</body>

</html>

HTML Formatting Elements


Formatting elements were designed to display special types of text:

 <b> - Bold text


 <strong> - Important text
 <i> - Italic text
 <em> - Emphasized text
 <mark> - Marked text
 <small> - Smaller text
 <del> - Deleted text
 <ins> - Inserted text
 <sub> - Subscript text
 <sup> - Superscript text

<!DOCTYPE html>

<html>

<body>

<p><b>This text is bold</b></p>


<p><i>This text is italic</i></p>

<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>

</body>

</html>

Html quotation

<!DOCTYPE html>

<html>

<body>

<p>Here is a quote from WWF's website:</p>

<blockquote cite="http://www.worldwildlife.org/who/index.html">

For 60 years, WWF has worked to help people and nature thrive. As the world's leading conservation
organization, WWF works in nearly 100 countries. At every level, we collaborate with people around
the world to develop and deliver innovative solutions that protect communities, wildlife, and the
places in which they live.

</blockquote>

</body>

</html>

Comments

<!-- Write your comments here -->

<!DOCTYPE html>

<html>
<body>

<!-- This is a comment -->

<p>This is a paragraph.</p>

<!-- Comments are not displayed in the browser -->

</body>

</html>

Hiding content

<!DOCTYPE html>

<html>

<body>

<p>This is a paragraph.</p>

<!--

<p>Look at this cool image:</p>

<img border="0" src="pic_trulli.jpg" alt="Trulli">

-->

<p>This is a paragraph too.</p>

</body>

</html>

Html colors

<!DOCTYPE html>
<html>

<body>

<h1 style="background-color:Tomato;">Tomato</h1>

<h1 style="background-color:Orange;">Orange</h1>

<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>

<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>

<h1 style="background-color:Gray;">Gray</h1>

<h1 style="background-color:SlateBlue;">SlateBlue</h1>

<h1 style="background-color:Violet;">Violet</h1>

<h1 style="background-color:LightGray;">LightGray</h1>

</body>

</html>

RGB

<!DOCTYPE html>

<html>

<body>

<h1 style="background-color:rgb(255, 0, 0);">rgb(255, 0, 0)</h1>

<h1 style="background-color:rgb(0, 0, 255);">rgb(0, 0, 255)</h1>

<h1 style="background-color:rgb(60, 179, 113);">rgb(60, 179, 113)</h1>

<h1 style="background-color:rgb(238, 130, 238);">rgb(238, 130, 238)</h1>

<h1 style="background-color:rgb(255, 165, 0);">rgb(255, 165, 0)</h1>

<h1 style="background-color:rgb(106, 90, 205);">rgb(106, 90, 205)</h1>

</body>

</html>
Hex color

<!DOCTYPE html>

<html>

<body>

<h1 style="background-color:#ff0000;">#ff0000</h1>

<h1 style="background-color:#0000ff;">#0000ff</h1>

<h1 style="background-color:#3cb371;">#3cb371</h1>

<h1 style="background-color:#ee82ee;">#ee82ee</h1>

<h1 style="background-color:#ffa500;">#ffa500</h1>

<h1 style="background-color:#6a5acd;">#6a5acd</h1>

</body>

</html>

Html table

<table style="width:100%">

<tr>

<th>Company</th>

<th>Contact</th>

<th>Country</th>

</tr>

<tr>

<td>Alfreds Futterkiste</td>

<td>Maria Anders</td>

<td>Germany</td>
</tr>

<tr>

<td>Centro comercial Moctezuma</td>

<td>Francisco Chang</td>

<td>Mexico</td>

</tr>

</table>

Html with css

<!DOCTYPE html>

<html>

<style>

table, th, td {

border:1px solid black;

</style>

<body>

<h2>A basic HTML table</h2>

<table style="width:100%">

<tr>

<th>Company</th>

<th>Contact</th>

<th>Country</th>

</tr>

<tr>

<td>Alfreds Futterkiste</td>

<td>Maria Anders</td>

<td>Germany</td>

</tr>
<tr>

<td>Centro comercial Moctezuma</td>

<td>Francisco Chang</td>

<td>Mexico</td>

</tr>

</table>

<p>To understand the example better, we have added borders to the table.</p>

</body>

</html>

Adding border

table, th, td {

border: 1px solid black;

Table size

<table style="width:100%">

CSS

Css example

<!DOCTYPE html>

<html>

<head>

<style>

body {

background-color: lightblue;
}

h1 {

color: white;

text-align: center;

p{

font-family: verdana;

font-size: 20px;

</style>

</head>

<body>

<h1>My First CSS Example</h1>

<p>This is a paragraph.</p>

</body>

</html>

<!DOCTYPE html>

<html>

<head>

<style>

table {

font-family: arial, sans-serif;

border-collapse: collapse;
width: 100%;

td, th {

border: 1px solid #dddddd;

text-align: left;

padding: 8px;

tr:nth-child(even) {

background-color: #dddddd;

</style>

</head>

<body>

<h2>HTML Table</h2>

<table>

<tr>

<th>Company</th>

<th>Contact</th>

<th>Country</th>

</tr>

<tr>

<td>Alfreds Futterkiste</td>

<td>Maria Anders</td>

<td>Germany</td>

</tr>

<tr>

<td>Centro comercial Moctezuma</td>


<td>Francisco Chang</td>

<td>Mexico</td>

</tr>

<tr>

<td>Ernst Handel</td>

<td>Roland Mendel</td>

<td>Austria</td>

</tr>

<tr>

<td>Island Trading</td>

<td>Helen Bennett</td>

<td>UK</td>

</tr>

<tr>

<td>Laughing Bacchus Winecellars</td>

<td>Yoshi Tannamuri</td>

<td>Canada</td>

</tr>

<tr>

<td>Magazzini Alimentari Riuniti</td>

<td>Giovanni Rovelli</td>

<td>Italy</td>

</tr>

</table>

</body>

</html>

Html list

<!DOCTYPE html>
<html>

<body>

<h2>An Unordered HTML List</h2>

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ul>

<h2>An Ordered HTML List</h2>

<ol>

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ol>

</body>

</html>

<!DOCTYPE html>

<html>

<body>

<h2>A Description List</h2>

<dl>

<dt>Coffee</dt>

<dd>- black hot drink</dd>


<dt>Milk</dt>

<dd>- white cold drink</dd>

</dl>

</body>

</html>

Block-level Elements
A block-level element always starts on a new line, and the browsers
automatically add some space (a margin) before and after the element.

A block-level element always takes up the full width available (stretches out
to the left and right as far as it can).

Two commonly used block elements are: <p> and <div>.

The <p> element defines a paragraph in an HTML document.

The <div> element defines a division or a section in an HTML document.

The <p> element is a block-level element.

The <div> element is a block-level element.

<!DOCTYPE html>

<html>

<body>

<p style="border: 1px solid black">Hello World</p>

<div style="border: 1px solid black">Hello World</div>

<p>The P and the DIV elements are both block elements, and they will always start on a new line and
take up the full width available (stretches out to the left and right as far as it can).</p>
</body>

</html>

Div nested

<!DOCTYPE html>

<html>

<style>

div {

background-color: #FFF4A3;

</style>

<body>

<h1>HTML DIV Example</h1>

Lorem Ipsum <div>I am a div</div> dolor sit amet.

<p>The yellow background is added to demonstrate the footprint of the DIV element.</p>

</body>

</html>

<!DOCTYPE html>

<html>

<head>

<style>

.city {
background-color: tomato;

color: white;

border: 2px solid black;

margin: 20px;

padding: 20px;

</style>

</head>

<body>

<div class="city">

<h2>London</h2>

<p>London is the capital of England.</p>

</div>

<div class="city">

<h2>Paris</h2>

<p>Paris is the capital of France.</p>

</div>

<div class="city">

<h2>Tokyo</h2>

<p>Tokyo is the capital of Japan.</p>

</div>

</body>

</html>

Html id

<!DOCTYPE html>
<html>

<head>

<style>

#myHeader {

background-color: lightblue;

color: black;

padding: 40px;

text-align: center;

</style>

</head>

<body>

<h2>The id Attribute</h2>

<p>Use CSS to style an element with the id "myHeader":</p>

<h1 id="myHeader">My Header</h1>

</body>

</html>

Muliple classes

<!DOCTYPE html>

<html>

<head>

<style>

.city {

background-color: tomato;

color: white;

padding: 10px;
}

.main {

text-align: center;

</style>

</head>

<body>

<h2>Multiple Classes</h2>

<p>Here, all three h2 elements belongs to the "city" class. In addition, London also belongs to the
"main" class, which center-aligns the text.</p>

<h2 class="city main">London</h2>

<h2 class="city">Paris</h2>

<h2 class="city">Tokyo</h2>

</body>

</html>

Html symbols

<!DOCTYPE html>

<html>

<body>

<p>I will display &euro;</p>

<p>I will display &#8364;</p>

<p>I will display &#x20AC;</p>

</body>
</html>

Emojis

<!DOCTYPE html>

<html>

<meta charset="UTF-8">

<body>

<h1>My First Emoji</h1>

<p>&#128512;</p>

</body>

</html>

Html responsive web

<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>

<body>

<h2>Setting the Viewport</h2>

<p>This example does not really do anything, other than showing you how to add the viewport meta
element.</p>

</body>
</html>

The <form> Element


The HTML <form> element is used to create an HTML form for user input:

<form>
.
form elements
.
</form>

The <form> element is a container for different types of input elements, such
as: text fields, checkboxes, radio buttons, submit buttons, etc.

All the different form elements are covered in this chapter: HTML Form
Elements.

The <input> Element


The HTML <input> element is the most used form element.

An <input> element can be displayed in many ways, depending on


the type attribute.

Here are some examples:

Type Description

<input type="text"> Displays a single-line text input field

<input type="radio"> Displays a radio button (for selecting one of many choices)

<input type="checkbox"> Displays a checkbox (for selecting zero or more of many ch


<input type="submit"> Displays a submit button (for submitting the form)

<input type="button"> Displays a clickable button

HTML Input Types


Here are the different input types you can use in HTML:

 <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">

<!DOCTYPE html>

<html>

<body>

<h2>Password field</h2>

<p>The <strong>input type="password"</strong> defines a password field:</p>


<form action="/action_page.php">

<label for="username">Username:</label><br>

<input type="text" id="username" name="username"><br>

<label for="pwd">Password:</label><br>

<input type="password" id="pwd" name="pwd"><br><br>

<input type="submit" value="Submit">

</form>

<p>The characters in a password field are masked (shown as asterisks or circles).</p>

</body>

</html>

Example form

<!DOCTYPE html>

<html>

<body>

<h2>Radio Buttons</h2>

<p>The <strong>input type="radio"</strong> defines a radio button:</p>

<p>Choose your favorite Web language:</p>

<form action="/action_page.php">

<input type="radio" id="html" name="fav_language" value="HTML">

<label for="html">HTML</label><br>

<input type="radio" id="css" name="fav_language" value="CSS">

<label for="css">CSS</label><br>

<input type="radio" id="javascript" name="fav_language" value="JavaScript">

<label for="javascript">JavaScript</label><br><br>

<input type="submit" value="Submit">


</form>

</body>

</html>

Html canvas

<!DOCTYPE html>

<html>

<body>

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">

Your browser does not support the HTML canvas tag.

</canvas>

</body>

</html>

<!DOCTYPE html>

<html>

<body>

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">

Your browser does not support the HTML canvas tag.</canvas>

<script>

var c = document.getElementById("myCanvas");

var ctx = c.getContext("2d");

ctx.beginPath();

ctx.arc(95,50,40,0,2*Math.PI);

ctx.stroke();
</script>

</body>

</html>

<!DOCTYPE html>

<html>

<body>

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">

Your browser does not support the HTML canvas tag.</canvas>

<script>

var c = document.getElementById("myCanvas");

var ctx = c.getContext("2d");

ctx.moveTo(0,0);

ctx.lineTo(200,100);

ctx.stroke();

</script>

</body>

</html>

Html video

<!DOCTYPE html>

<html>

<body>

<video width="320" height="240" controls>

<source src="movie.mp4" type="video/mp4">


<source src="movie.ogg" type="video/ogg">

Your browser does not support the video tag.

</video>

</body>

</html>

<!DOCTYPE html>

<html>

<body>

<iframe width="420" height="345" src="https://www.youtube.com/embed/tgbNymZ7vqY">

</iframe>

</body>

</html>

CSS

Using CSS
CSS can be added to HTML documents in 3 ways:

 Inline - by using the style attribute inside HTML elements


 Internal - by using a <style> element in the <head> section
 External - by using a <link> element to link to an external CSS file

The most common way to add CSS, is to keep the styles in external CSS files.
However, in this tutorial we will use inline and internal styles, because this is
easier to demonstrate, and easier for you to try it yourself.

Inline CSS
An inline CSS is used to apply a unique style to a single HTML element.
An inline CSS uses the style attribute of an HTML element.

The following example sets the text color of the <h1> element to blue, and the
text color of the <p> element to red:

<!DOCTYPE html>

<html>

<body>

<h1 style="color:blue;">A Blue Heading</h1>

<p style="color:red;">A red paragraph.</p>

</body>

</html>

Internal CSS
An internal CSS is used to define a style for a single HTML page.

An internal CSS is defined in the <head> section of an HTML page, within


a <style> element.

The following example sets the text color of ALL the <h1> elements (on that
page) to blue, and the text color of ALL the <p> elements to red. In addition,
the page will be displayed with a "powderblue" background color:

<!DOCTYPE html>

<html>

<head>

<style>

body {background-color: powderblue;}

h1 {color: blue;}

p {color: red;}

</style>
</head>

<body>

<h1>This is a heading</h1>

<p>This is a paragraph.</p>

</body>

</html>

External CSS
An external style sheet is used to define the style for many HTML pages.

To use an external style sheet, add a link to it in the <head> section of each
HTML page:

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<h1>This is a heading</h1>

<p>This is a paragraph.</p>

</body>

</html>

Css
CSS is the language we use to style an HTML document.

CSS describes how HTML elements should be displayed.

This tutorial will teach you CSS from basic to advanced.

CSS Syntax

<!DOCTYPE html>

<html>

<head>

<style>

p{

color: red;

text-align: center;

</style>

</head>

<body>

<p>Hello World!</p>

<p>These paragraphs are styled with CSS.</p>

</body>

</html>
<!DOCTYPE html>

<html>

<head>

<style>

body {

background-color: lightblue;

h1 {

color: white;

text-align: center;

p{

font-family: verdana;

font-size: 20px;

</style>

</head>

<body>

<h1>My First CSS Example</h1>

<p>This is a paragraph.</p>

</body>

</html>
Css elemenet

<!DOCTYPE html>

<html>

<head>

<style>

p{

text-align: center;

color: red;

</style>

</head>

<body>

<p>Every paragraph will be affected by the style.</p>

<p id="para1">Me too!</p>

<p>And me!</p>

</body>

</html>

The CSS id Selector

<!DOCTYPE html>

<html>

<head>

<style>

#para1 {
text-align: center;

color: red;

</style>

</head>

<body>

<p id="para1">Hello World!</p>

<p>This paragraph is not affected by the style.</p>

</body>

</html>

Comments

<!DOCTYPE html>

<html>

<head>

<style>

/* This is a single-line comment */

p{

color: red;

</style>

</head>

<body>

<p>Hello World!</p>

<p>This paragraph is styled with CSS.</p>

<p>CSS comments are not shown in the output.</p>


</body>

</html>

Muliline comments

/* This is
a multi-line
comment */

p {
color: red;
}

Colors

<!DOCTYPE html>

<html>

<body>

<h1>Specify colors using RGB values</h1>

<h2 style="background-color:rgb(255, 0, 0);">rgb(255, 0, 0)</h2>

<h2 style="background-color:rgb(0, 0, 255);">rgb(0, 0, 255)</h2>

<h2 style="background-color:rgb(60, 179, 113);">rgb(60, 179, 113)</h2>

<h2 style="background-color:rgb(238, 130, 238);">rgb(238, 130, 238)</h2>

<h2 style="background-color:rgb(255, 165, 0);">rgb(255, 165, 0)</h2>

<h2 style="background-color:rgb(106, 90, 205);">rgb(106, 90, 205)</h2>

</body>

</html>
<!DOCTYPE html>

<html>

<head>

<style>

body {

background-color: lightblue;

</style>

</head>

<body>

<h1>Hello World!</h1>

<p>This page has a light blue background color!</p>

</body>

</html>

Background image

<!DOCTYPE html>

<html>

<head>

<style>

body {

background-image: url("paper.gif");

</style>

</head>

<body>
<h1>Hello World!</h1>

<p>This page has an image as the background!</p>

</body>

</html>

CSS Border Style


The border-style property specifies what kind of border to display.

The following values are allowed:

 dotted - Defines a dotted border


 dashed - Defines a dashed border
 solid - Defines a solid border
 double - Defines a double border
 groove - Defines a 3D grooved border. The effect depends on the
border-color value
 ridge - Defines a 3D ridged border. The effect depends on the border-
color value
 inset - Defines a 3D inset border. The effect depends on the border-
color value
 outset - Defines a 3D outset border. The effect depends on the
border-color value
 none - Defines no border
 hidden - Defines a hidden border

<!DOCTYPE html>

<html>

<head>

<style>

p.dotted {border-style: dotted;}

p.dashed {border-style: dashed;}

p.solid {border-style: solid;}

p.double {border-style: double;}


p.groove {border-style: groove;}

p.ridge {border-style: ridge;}

p.inset {border-style: inset;}

p.outset {border-style: outset;}

p.none {border-style: none;}

p.hidden {border-style: hidden;}

p.mix {border-style: dotted dashed solid double;}

</style>

</head>

<body>

<h2>The border-style Property</h2>

<p>This property specifies what kind of border to display:</p>

<p class="dotted">A dotted border.</p>

<p class="dashed">A dashed border.</p>

<p class="solid">A solid border.</p>

<p class="double">A double border.</p>

<p class="groove">A groove border.</p>

<p class="ridge">A ridge border.</p>

<p class="inset">An inset border.</p>

<p class="outset">An outset border.</p>

<p class="none">No border.</p>

<p class="hidden">A hidden border.</p>

<p class="mix">A mixed border.</p>

</body>

</html>

<!DOCTYPE html>
<html>

<head>

<style>

p.one {

border-style: solid;

border-width: 5px;

p.two {

border-style: solid;

border-width: medium;

p.three {

border-style: dotted;

border-width: 2px;

p.four {

border-style: dotted;

border-width: thick;

p.five {

border-style: double;

border-width: 15px;

p.six {

border-style: double;

border-width: thick;
}

</style>

</head>

<body>

<h2>The border-width Property</h2>

<p>This property specifies the width of the four borders:</p>

<p class="one">Some text.</p>

<p class="two">Some text.</p>

<p class="three">Some text.</p>

<p class="four">Some text.</p>

<p class="five">Some text.</p>

<p class="six">Some text.</p>

<p><b>Note:</b> The "border-width" property does not work if it is used alone.

Always specify the "border-style" property to set the borders first.</p>

</body>

</html>

Color

<!DOCTYPE html>

<html>

<head>

<style>

p.one {

border-style: solid;

border-color: red;
}

p.two {

border-style: solid;

border-color: green;

p.three {

border-style: dotted;

border-color: blue;

</style>

</head>

<body>

<h2>The border-color Property</h2>

<p>This property specifies the color of the four borders:</p>

<p class="one">A solid red border</p>

<p class="two">A solid green border</p>

<p class="three">A dotted blue border</p>

<p><b>Note:</b> The "border-color" property does not work if it is used alone. Use the "border-
style" property to set the borders first.</p>

</body>

</html>

Css margins
<!DOCTYPE html>

<html>

<head>

<style>

div {

margin: 70px;

border: 1px solid #4CAF50;

</style>

</head>

<body>

<h2>CSS Margins</h2>

<div>This element has a margin of 70px.</div>

</body>

</html>

Css margins

<!DOCTYPE html>

<html>

<head>

<style>

div {

padding: 70px;

border: 1px solid #4CAF50;

</style>

</head>

<body>
<h2>CSS Padding</h2>

<div>This element has a padding of 70px.</div>

</body>

</html>

Height and width

<!DOCTYPE html>

<html>

<head>

<style>

div {

height: 100px;

width: 500px;

background-color: powderblue;

</style>

</head>

<body>

<h2>Set the height and width of an element</h2>

<div>This div element has a height of 100px and a width of 500px.</div>

</body>

</html>
Css box model

 Content - The content of the box, where text and images appear
 Padding - Clears an area around the content. The padding is
transparent
 Border - A border that goes around the padding and content
 Margin - Clears an area outside the border. The margin is transparent

<!DOCTYPE html>

<html>

<head>

<style>

div {

background-color: lightgrey;

width: 300px;

border: 15px solid green;

padding: 50px;

margin: 20px;

</style>

</head>

<body>

<h2>Demonstrating the Box Model</h2>

<p>The CSS box model is essentially a box that wraps around every HTML element. It consists of:
borders, padding, margins, and the actual content.</p>

<div>This text is the content of the box. We have added a 50px padding, 20px margin and a 15px
green border. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.</div>
</body>

</html>

Css list

<!DOCTYPE html>

<html>

<head>

<style>

ul.a {

list-style-type: circle;

ul.b {

list-style-type: square;

ol.c {

list-style-type: upper-roman;

ol.d {

list-style-type: lower-alpha;

</style>

</head>

<body>

<h2>The list-style-type Property</h2>


<p>Example of unordered lists:</p>

<ul class="a">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

<ul class="b">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

<p>Example of ordered lists:</p>

<ol class="c">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ol>

<ol class="d">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ol>

</body>

</html>

Css link
The four links states are:

 a:link - a normal, unvisited link


 a:visited - a link the user has visited
 a:hover - a link when the user mouses over it
 a:active - a link the moment it is clicked

<!DOCTYPE html>

<html>

<head>

<style>

/* unvisited link */

a:link {

color: red;

/* visited link */

a:visited {

color: green;

/* mouse over link */

a:hover {

color: hotpink;

/* selected link */

a:active {

color: blue;

</style>

</head>

<body>
<h2>Styling a link depending on state</h2>

<p><b><a href="default.asp" target="_blank">This is a link</a></b></p>

<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be
effective.</p>

<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be
effective.</p>

</body>

</html>

Css tables

<!DOCTYPE html>

<html>

<head>

<style>

#customers {

font-family: Arial, Helvetica, sans-serif;

border-collapse: collapse;

width: 100%;

#customers td, #customers th {

border: 1px solid #ddd;

padding: 8px;

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}


#customers th {

padding-top: 12px;

padding-bottom: 12px;

text-align: left;

background-color: #04AA6D;

color: white;

</style>

</head>

<body>

<h1>A Fancy Table</h1>

<table id="customers">

<tr>

<th>Company</th>

<th>Contact</th>

<th>Country</th>

</tr>

<tr>

<td>Alfreds Futterkiste</td>

<td>Maria Anders</td>

<td>Germany</td>

</tr>

<tr>

<td>Berglunds snabbköp</td>

<td>Christina Berglund</td>

<td>Sweden</td>

</tr>

<tr>
<td>Centro comercial Moctezuma</td>

<td>Francisco Chang</td>

<td>Mexico</td>

</tr>

<tr>

<td>Ernst Handel</td>

<td>Roland Mendel</td>

<td>Austria</td>

</tr>

<tr>

<td>Island Trading</td>

<td>Helen Bennett</td>

<td>UK</td>

</tr>

<tr>

<td>Königlich Essen</td>

<td>Philip Cramer</td>

<td>Germany</td>

</tr>

<tr>

<td>Laughing Bacchus Winecellars</td>

<td>Yoshi Tannamuri</td>

<td>Canada</td>

</tr>

<tr>

<td>Magazzini Alimentari Riuniti</td>

<td>Giovanni Rovelli</td>

<td>Italy</td>

</tr>

<tr>

<td>North/South</td>
<td>Simon Crowther</td>

<td>UK</td>

</tr>

<tr>

<td>Paris spécialités</td>

<td>Marie Bertrand</td>

<td>France</td>

</tr>

</table>

</body>

</html>

Css display

The display property has many values:

Value Description

inline Displays an element as an inline element

block Displays an element as a block element

contents Makes the container disappear, making the child elements children of the elem
next level up in the DOM

Flex Displays an element as a block-level flex container


Grid Displays an element as a block-level grid container

inline-block Displays an element as an inline-level block container. The element itself is fo


as an inline element, but you can apply height and width values

inline-flex Displays an element as an inline-level flex container

inline-grid Displays an element as an inline-level grid container

inline-table The element is displayed as an inline-level table

list-item Let the element behave like a <li> element

run-in Displays an element as either block or inline, depending on conte

table Let the element behave like a <table> element

table-caption Let the element behave like a <caption> element

table-column-group Let the element behave like a <colgroup> element

table-header-group Let the element behave like a <thead> element

table-footer-group Let the element behave like a <tfoot> element


table-row-group Let the element behave like a <tbody> element

table-cell Let the element behave like a <td> element

table-column Let the element behave like a <col> element

table-row Let the element behave like a <tr> element

none The element is completely removed

initial Sets this property to its default value

inherit Inherits this property from its parent element

<!DOCTYPE html>

<html>

<head>

<style>

div.ex1 {

width: 500px;

margin: auto;

border: 3px solid #73AD21;

}
div.ex2 {

max-width: 500px;

margin: auto;

border: 3px solid #73AD21;

</style>

</head>

<body>

<h2>CSS Max-width</h2>

<div class="ex1">This div element has width: 500px;</div>

<br>

<div class="ex2">This div element has max-width: 500px;</div>

<p><strong>Tip:</strong> Drag the browser window to smaller than 500px wide, to see the
difference between

the two divs!</p>

</body>

</html>

The position Property


The position property specifies the type of positioning method used for an
element.

There are five different position values:


 static
 relative
 fixed
 absolute
 sticky

static

<!DOCTYPE html>

<html>

<head>

<style>

div.static {

position: static;

border: 3px solid #73AD21;

</style>

</head>

<body>

<h2>position: static;</h2>

<p>An element with position: static; is not positioned in any special way; it is always positioned
according to the normal flow of the page:</p>

<div class="static">

This div element has position: static;

</div>

</body>

</html>

Relative
<!DOCTYPE html>

<html>

<head>

<style>

div.relative {

position: relative;

left: 30px;

border: 3px solid #73AD21;

</style>

</head>

<body>

<h2>position: relative;</h2>

<p>An element with position: relative; is positioned relative to its normal position:</p>

<div class="relative">

This div element has position: relative;

</div>

</body>

</html>

Fixed

<!DOCTYPE html>

<html>

<head>

<style>

div.fixed {
position: fixed;

bottom: 0;

right: 0;

width: 300px;

border: 3px solid #73AD21;

</style>

</head>

<body>

<h2>position: fixed;</h2>

<p>An element with position: fixed; is positioned relative to the viewport, which means it always
stays in the same place even if the page is scrolled:</p>

<div class="fixed">

This div element has position: fixed;

</div>

</body>

</html>

Absolute

<!DOCTYPE html>

<html>

<head>

<style>

div.relative {

position: relative;

width: 400px;
height: 200px;

border: 3px solid #73AD21;

div.absolute {

position: absolute;

top: 80px;

right: 0;

width: 200px;

height: 100px;

border: 3px solid #73AD21;

</style>

</head>

<body>

<h2>position: absolute;</h2>

<p>An element with position: absolute; is positioned relative to the nearest positioned ancestor
(instead of positioned relative to the viewport, like fixed):</p>

<div class="relative">This div element has position: relative;

<div class="absolute">This div element has position: absolute;</div>

</div>

</body>

</html>

Sticky

<!DOCTYPE html>
<html>

<head>

<style>

div.sticky {

position: sticky;

top: 0;

padding: 5px;

background-color: #cae8ca;

border: 2px solid #4CAF50;

</style>

</head>

<body>

<p>Try to <b>scroll</b> inside this frame to understand how sticky positioning works.</p>

<div class="sticky">I am sticky!</div>

<div style="padding-bottom:2000px">

<p>In this example, the sticky element sticks to the top of the page (top: 0), when you reach its
scroll position.</p>

<p>Scroll back up to remove the stickyness.</p>

<p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset
concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur
eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae
voluptatibus.</p>

<p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset
concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur
eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae
voluptatibus.</p>

</div>

</body>
</html>

Z index usge

<!DOCTYPE html>

<html>

<head>

<style>

.container {

position: relative;

.black-box {

position: relative;

z-index: 1;

border: 2px solid black;

height: 100px;

margin: 30px;

.gray-box {

position: absolute;

z-index: 3; /* gray box will be above both green and black box */

background: lightgray;

height: 60px;

width: 70%;

left: 50px;

top: 50px;

.green-box {
position: absolute;

z-index: 2; /* green box will be above black box */

background: lightgreen;

width: 35%;

left: 270px;

top: -15px;

height: 100px;

</style>

</head>

<body>

<h1>Z-index Example</h1>

<p>An element with greater stack order is always above an element with a lower stack order.</p>

<div class="container">

<div class="black-box">Black box (z-index: 1)</div>

<div class="gray-box">Gray box (z-index: 3)</div>

<div class="green-box">Green box (z-index: 2)</div>

</div>

</body>

</html>

Without z index

<!DOCTYPE html>

<html>

<head>

<style>
.container {

position: relative;

.black-box {

position: relative;

border: 2px solid black;

height: 100px;

margin: 30px;

.gray-box {

position: absolute;

background: lightgray;

height: 60px;

width: 70%;

left: 50px;

top: 50px;

.green-box {

position: absolute;

background: lightgreen;

width: 35%;

left: 270px;

top: -15px;

height: 100px;

</style>

</head>

<body>
<h1>Overlapping elements</h1>

<p>If two positioned elements overlap each other without a z-index specified,

the element defined last in the HTML code will be shown on top:</p>

<div class="container">

<div class="black-box">Black box</div>

<div class="gray-box">Gray box</div>

<div class="green-box">Green box</div>

</div>

</body>

</html>

CSS Overflow
The overflow property specifies whether to clip the content or to add
scrollbars when the content of an element is too big to fit in the specified
area.

The overflow property has the following values:

 visible - Default. The overflow is not clipped. The content renders


outside the element's box
 hidden - The overflow is clipped, and the rest of the content will be
invisible
 scroll - The overflow is clipped, and a scrollbar is added to see the
rest of the content
 auto - Similar to scroll, but it adds scrollbars only when necessary

<!DOCTYPE html>

<html>

<head>
<style>

div {

background-color: coral;

width: 200px;

height: 65px;

border: 1px solid;

overflow: visible;

</style>

</head>

<body>

<h2>Overflow: visible</h2>

<p>By default, the overflow is visible, meaning that it is not clipped and it renders outside the
element's box:</p>

<div>You can use the overflow property when you want to have better control of the layout. The
overflow property specifies what happens if content overflows an element's box.</div>

</body>

</html>

Hiden

<!DOCTYPE html>

<html>

<head>

<style>

div {

background-color: coral;

width: 200px;

height: 65px;
border: 1px solid black;

overflow: hidden;

</style>

</head>

<body>

<h2>Overflow: hidden</h2>

<p>With the hidden value, the overflow is clipped, and the rest of the content is hidden:</p>

<p>Try to remove the overflow property to understand how it works.</p>

<div>You can use the overflow property when you want to have better control of the layout. The
overflow property specifies what happens if content overflows an element's box.</div>

</body>

</html>

Scroll

<!DOCTYPE html>

<html>

<head>

<style>

div {

background-color: coral;

width: 200px;

height: 100px;

border: 1px solid black;

overflow: scroll;
}

</style>

</head>

<body>

<h2>Overflow: scroll</h2>

<p>Setting the overflow value to scroll, the overflow is clipped and a scrollbar is added to scroll
inside the box. Note that this will add a scrollbar both horizontally and vertically (even if you do not
need it):</p>

<div>You can use the overflow property when you want to have better control of the layout. The
overflow property specifies what happens if content overflows an element's box.</div>

</body>

</html>

The float Property


The float property is used for positioning and formatting content e.g. let an
image float left to the text in a container.

The float property can have one of the following values:

 left - The element floats to the left of its container


 right - The element floats to the right of its container
 none - The element does not float (will be displayed just where it
occurs in the text). This is default
 inherit - The element inherits the float value of its parent

<!DOCTYPE html>

<html>

<head>
<style>

img {

float: right;

</style>

</head>

<body>

<h2>Float Right</h2>

<p>In this example, the image will float to the right in the paragraph, and the text in the paragraph
will wrap around the image.</p>

<p><img src="pineapple.jpg" alt="Pineapple" style="width:170px;height:170px;margin-left:15px;">

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum
interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est,
ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante
ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit
risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc
venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla
congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis
diam velit.</p>

</body>

</html>

Inline block

<!DOCTYPE html>

<html>

<head>

<style>

span.a {

display: inline; /* the default for span */


width: 100px;

height: 100px;

padding: 5px;

border: 1px solid blue;

background-color: yellow;

span.b {

display: inline-block;

width: 100px;

height: 100px;

padding: 5px;

border: 1px solid blue;

background-color: yellow;

span.c {

display: block;

width: 100px;

height: 100px;

padding: 5px;

border: 1px solid blue;

background-color: yellow;

</style>

</head>

<body>

<h1>The display Property</h1>

<h2>display: inline</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat scelerisque elit
sit amet consequat. Aliquam erat volutpat. <span class="a">Aliquam</span> <span
class="a">venenatis</span> gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet.
</div>

<h2>display: inline-block</h2>

<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat scelerisque elit
sit amet consequat. Aliquam erat volutpat. <span class="b">Aliquam</span> <span
class="b">venenatis</span> gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet.
</div>

<h2>display: block</h2>

<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat scelerisque elit
sit amet consequat. Aliquam erat volutpat. <span class="c">Aliquam</span> <span
class="c">venenatis</span> gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet.
</div>

</body>

</html>

Inline block (menus)

<!DOCTYPE html>

<html>

<head>

<style>

.nav {

background-color: yellow;

list-style-type: none;

text-align: center;

margin: 0;

padding: 0;

}
.nav li {

display: inline-block;

font-size: 20px;

padding: 20px;

</style>

</head>

<body>

<h1>Horizontal Navigation Links</h1>

<p>By default, list items are displayed vertically. In this example we use display: inline-block to
display them horizontally (side by side).</p>

<p>Note: If you resize the browser window, the links will automatically break when it becomes too
crowded.</p>

<ul class="nav">

<li><a href="#home">Home</a></li>

<li><a href="#about">About Us</a></li>

<li><a href="#clients">Our Clients</a></li>

<li><a href="#contact">Contact Us</a></li>

</ul>

</body>

</html>

Align

<!DOCTYPE html>

<html>

<head>
<style>

.center {

margin: auto;

width: 60%;

border: 3px solid #73AD21;

padding: 10px;

</style>

</head>

<body>

<h2>Center Align Elements</h2>

<p>To horizontally center a block element (like div), use margin: auto;</p>

<div class="center">

<p>Hello World!</p>

</div>

</body>

</html>

Opacity

<!DOCTYPE html>

<html>

<head>

<style>

img {

opacity: 0.5;

</style>
</head>

<body>

<h1>Image Transparency</h1>

<p>The opacity property specifies the transparency of an element. The lower the value, the more
transparent:</p>

<p>Image with 50% opacity:</p>

<img src="img_forest.jpg" alt="Forest" width="170" height="100">

</body>

</html>

Nav bar

Vertical navbar

Without css

<!DOCTYPE html>

<html>

<body>

<ul>

<li><a href="#home">Home</a></li>

<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>

<li><a href="#about">About</a></li>

</ul>

<p>Note: We use href="#" for test links. In a real web site this would be URLs.</p>

</body>

</html>

With css

<!DOCTYPE html>

<html>

<head>

<style>

ul {

list-style-type: none;

margin: 0;

padding: 0;

width: 200px;

background-color: #f1f1f1;

li a {

display: block;

color: #000;

padding: 8px 16px;

text-decoration: none;

/* Change the link color on hover */


li a:hover {

background-color: #555;

color: white;

</style>

</head>

<body>

<h2>Vertical Navigation Bar</h2>

<ul>

<li><a href="#home">Home</a></li>

<li><a href="#news">News</a></li>

<li><a href="#contact">Contact</a></li>

<li><a href="#about">About</a></li>

</ul>

</body>

</html>

Horizontal

<!DOCTYPE html>

<html>

<head>

<style>

ul {

list-style-type: none;

margin: 0;

padding: 0;
}

li {

display: inline;

</style>

</head>

<body>

<ul>

<li><a href="#home">Home</a></li>

<li><a href="#news">News</a></li>

<li><a href="#contact">Contact</a></li>

<li><a href="#about">About</a></li>

</ul>

</body>

</html>

With active bar

<!DOCTYPE html>

<html>

<head>

<style>

ul {

list-style-type: none;

margin: 0;

padding: 0;

overflow: hidden;
background-color: #333;

li {

float: left;

li a {

display: block;

color: white;

text-align: center;

padding: 14px 16px;

text-decoration: none;

li a:hover:not(.active) {

background-color: #111;

.active {

background-color: #04AA6D;

</style>

</head>

<body>

<ul>

<li><a class="active" href="#home">Home</a></li>

<li><a href="#news">News</a></li>

<li><a href="#contact">Contact</a></li>

<li><a href="#about">About</a></li>
</ul>

</body>

</html>

Dropdown menu

<!DOCTYPE html>

<html>

<head>

<style>

.dropbtn {

background-color: #4CAF50;

color: white;

padding: 16px;

font-size: 16px;

border: none;

cursor: pointer;

.dropdown {

position: relative;

display: inline-block;

.dropdown-content {

display: none;

position: absolute;

background-color: #f9f9f9;

min-width: 160px;

box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);


z-index: 1;

.dropdown-content a {

color: black;

padding: 12px 16px;

text-decoration: none;

display: block;

.dropdown-content a:hover {background-color: #f1f1f1}

.dropdown:hover .dropdown-content {

display: block;

.dropdown:hover .dropbtn {

background-color: #3e8e41;

</style>

</head>

<body>

<h2>Dropdown Menu</h2>

<p>Move the mouse over the button to open the dropdown menu.</p>

<div class="dropdown">

<button class="dropbtn">Dropdown</button>

<div class="dropdown-content">

<a href="#">Link 1</a>

<a href="#">Link 2</a>


<a href="#">Link 3</a>

</div>

</div>

<p><strong>Note:</strong> We use href="#" for test links. In a real web site this would be
URLs.</p>

</body>

</html>

Css counters

<!DOCTYPE html>

<html>

<head>

<style>

body {

counter-reset: section;

h2::before {

counter-increment: section;

content: "Section " counter(section) ": ";

</style>

</head>

<body>

<h1>Using CSS Counters</h1>


<h2>HTML Tutorial</h2>

<h2>CSS Tutorial</h2>

<h2>JavaScript Tutorial</h2>

<h2>Python Tutorial</h2>

<h2>SQL Tutorial</h2>

</body>

</html>

Website layout

<!DOCTYPE html>

<html>

<head>

<style>

*{

box-sizing: border-box;

body {

font-family: Arial;

padding: 10px;

background: #f1f1f1;

/* Header/Blog Title */

.header {

padding: 30px;

text-align: center;

background: white;
}

.header h1 {

font-size: 50px;

/* Style the top navigation bar */

.topnav {

overflow: hidden;

background-color: #333;

/* Style the topnav links */

.topnav a {

float: left;

display: block;

color: #f2f2f2;

text-align: center;

padding: 14px 16px;

text-decoration: none;

/* Change color on hover */

.topnav a:hover {

background-color: #ddd;

color: black;

/* Create two unequal columns that floats next to each other */

/* Left column */

.leftcolumn {
float: left;

width: 75%;

/* Right column */

.rightcolumn {

float: left;

width: 25%;

background-color: #f1f1f1;

padding-left: 20px;

/* Fake image */

.fakeimg {

background-color: #aaa;

width: 100%;

padding: 20px;

/* Add a card effect for articles */

.card {

background-color: white;

padding: 20px;

margin-top: 20px;

/* Clear floats after the columns */

.row::after {

content: "";

display: table;

clear: both;
}

/* Footer */

.footer {

padding: 20px;

text-align: center;

background: #ddd;

margin-top: 20px;

/* Responsive layout - when the screen is less than 800px wide, make the two columns stack on top
of each other instead of next to each other */

@media screen and (max-width: 800px) {

.leftcolumn, .rightcolumn {

width: 100%;

padding: 0;

/* Responsive layout - when the screen is less than 400px wide, make the navigation links stack on
top of each other instead of next to each other */

@media screen and (max-width: 400px) {

.topnav a {

float: none;

width: 100%;

</style>

</head>

<body>

<div class="header">
<h1>My Website</h1>

<p>Resize the browser window to see the effect.</p>

</div>

<div class="topnav">

<a href="#">Link</a>

<a href="#">Link</a>

<a href="#">Link</a>

<a href="#" style="float:right">Link</a>

</div>

<div class="row">

<div class="leftcolumn">

<div class="card">

<h2>TITLE HEADING</h2>

<h5>Title description, Dec 7, 2017</h5>

<div class="fakeimg" style="height:200px;">Image</div>

<p>Some text..</p>

<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco.</p>

</div>

<div class="card">

<h2>TITLE HEADING</h2>

<h5>Title description, Sep 2, 2017</h5>

<div class="fakeimg" style="height:200px;">Image</div>

<p>Some text..</p>

<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco.</p>

</div>

</div>
<div class="rightcolumn">

<div class="card">

<h2>About Me</h2>

<div class="fakeimg" style="height:100px;">Image</div>

<p>Some text about me in culpa qui officia deserunt mollit anim..</p>

</div>

<div class="card">

<h3>Popular Post</h3>

<div class="fakeimg"><p>Image</p></div>

<div class="fakeimg"><p>Image</p></div>

<div class="fakeimg"><p>Image</p></div>

</div>

<div class="card">

<h3>Follow Me</h3>

<p>Some text..</p>

</div>

</div>

</div>

<div class="footer">

<h2>Footer</h2>

</div>

</body>

</html>

Css buttons

<!DOCTYPE html>

<html>
<head>

<style>

.button {

background-color: #04AA6D;

border: none;

color: white;

padding: 15px 32px;

text-align: center;

text-decoration: none;

display: inline-block;

font-size: 16px;

margin: 4px 2px;

cursor: pointer;

</style>

</head>

<body>

<h2>CSS Buttons</h2>

<button>Default Button</button>

<a href="#" class="button">Link Button</a>

<button class="button">Button</button>

<input type="button" class="button" value="Input Button">

</body>

</html>

Css page

<!DOCTYPE html>
<html>

<head>

<style>

.pagination {

display: inline-block;

.pagination a {

color: black;

float: left;

padding: 8px 16px;

text-decoration: none;

</style>

</head>

<body>

<h2>Simple Pagination</h2>

<div class="pagination">

<a href="#">&laquo;</a>

<a href="#">1</a>

<a href="#">2</a>

<a href="#">3</a>

<a href="#">4</a>

<a href="#">5</a>

<a href="#">6</a>

<a href="#">&raquo;</a>

</div>

</body>
</html>

You might also like