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

CSS Properties 02

Uploaded by

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

CSS Properties 02

Uploaded by

PokeSparker X
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Text align

<!DOCTYPE html>

<html>

<head>

<title>Text align</title>

<style>

div.a {

text-align:right;

color:#F67280;

background:tan;

div.b {

text-align:center;

color:#6495ED;

background:yellow;

div.c {

text-align:left;

color:green;

background:pink;

div.d {

text-align:justify;

color:purple;

background:grey;

</style>

</head>
<body>

<h1>The text-align Property</h1>

<div class="a">

<h2>text-align: right</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis
blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p>

</div>

<div class="b">

<h2>text-align:center</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis
blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p>

</div>

<div class="c">

<h2>text-align: left</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis
blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p>

</div>

<div class="d">

<h2>text-align: justify:</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis
blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus
diam, consequat gravida libero rhoncus ut.</p>

</div>

</body>

</html>
TEXT-DECORATION-COLOR

<!DOCTYPE html>

<html>

<head>

<title>text-decoration-color</title>

<style>

h1 {

text-decoration-line: overline;

text-decoration-color: red;

h2 {

text-decoration-line: line-through;

text-decoration-color: blue;

}
h3 {

text-decoration-line: underline;

text-decoration-color: green;

p{

text-decoration-line: overline underline;

text-decoration-color: purple;

</style>

</head>

<body>

<h1>Overline text decoration</h1>

<h2>Line-through text decoration</h2>

<h3>Underline text decoration</h3>

<p>Overline and underline text decoration.</p>

</body>

</html>

** TEXT-DECORATION-STYLE

<!DOCTYPE html>

<html>

<head>

<title> text-decoration-style</title>

<style>
h1 {

text-decoration-line: underline;

text-decoration-style: solid; /* this is default */

h2 {

text-decoration-line: underline;

text-decoration-style: double;

h3 {

text-decoration-line: underline;

text-decoration-style: dotted;

p.ex1 {

text-decoration-line: underline;

text-decoration-style: dashed;

p.ex2 {

text-decoration-line: underline;

text-decoration-style: wavy;

p.ex3 {

text-decoration-line: underline;

text-decoration-color: red;

text-decoration-style: wavy;

</style>

</head>

<body>

<h1>Heading 1</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<p class="ex1">A paragraph.</p>


<p class="ex2">Another paragraph.</p>

<p class="ex3">Another paragraph.</p>

</body>

</html>

**TEXT-DECORATION-THICKNESS

<!DOCTYPE html>

<html>

<head>

<title> text-decoration-thickness</title>

<style>

h1 {

text-decoration-line: underline;

text-decoration-thickness: auto; /* this is default */

h2 {

text-decoration-line: underline;

text-decoration-thickness: 5px;

h3 {

text-decoration-line: underline;

text-decoration-thickness: 25%;
}

p{

text-decoration-line: underline;

text-decoration-color: red;

text-decoration-style: double;

text-decoration-thickness: 5px;

</style>

</head>

<body>

<h1>Heading 1</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<p>A paragraph.</p>

</body>

</html>

**TEXT-DECORATION SHORTHAND PROPERTY

<!DOCTYPE html>

<html>

<head>

<title>text-decoration shorthand property</title>

<style>
h1 {

text-decoration: underline;

h2 {

text-decoration: underline red;

h3 {

text-decoration: underline red double;

p{

text-decoration: underline red double 5px;

</style>

</head>

<body>

<h1>Heading 1</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<p>A paragraph.</p>

</body>

</html>
MARGIN IN CSS

<!DOCTYPE html>

<html>

<head>

<style>

div {

border: 1px solid black;

margin-top: 100px;

margin-bottom: 100px;

margin-right: 150px;

margin-left: 80px;

background-color: lightblue;

</style>

</head>

<body>

<h2>Using individual margin properties</h2>

<div>This div element has a top margin of 100px, a right margin of 150px, a bottom margin of 100px, and a left margin
of 80px.</div>

</body>

</html>
MARGIN SHORTHAND PROPERTY

<!DOCTYPE html>

<html>

<head>

<style>

div {

border: 1px solid black;

margin: 25px 50px 75px 100px;

background-color: lightblue;

</style>

</head>

<body>

<h2>The margin shorthand property - 4 values</h2>

<div>This div element has a top margin of 25px, a right margin of 50px, a bottom margin of 75px, and a left margin of
100px.</div>

</body>

</html>

BORDER IN CSS

<!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">Defines a dotted border</p>

<p class="dashed">Defines a dashed border</p>

<p class="solid">Defines 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>
border 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>

BORDER WIDTH IN CSS

<!DOCTYPE html>

<html>

<head>

<style>

p.one {

border-style: solid;

border-width: 5px 20px; /* 5px top and bottom, 20px on the sides */

p.two {

border-style: solid;

border-width: 20px 5px; /* 20px top and bottom, 5px on the sides */
}

p.three {

border-style: solid;

border-width: 25px 10px 4px 35px; /* 25px top, 10px right, 4px bottom and 35px left */

</style>

</head>

<body>

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

<p>The border-width property can have from one to four values (for the top border, right border, bottom border, and
the left border):</p>

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

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

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

</body>

</html>

BODER SHORTHAND PROPERTY

<!DOCTYPE html>

<html>

<head>

<style>

p{
border: 5px solid red;

</style>

</head>

<body>

<h2>The border Property</h2>

<p>This property is a shorthand property for border-width, border-style, and border-color.</p>

</body>

</html>

ROUND BORDER

<!DOCTYPE html>

<html>

<head>

<style>

p.normal {

border: 2px solid red;

padding: 5px;

p.round1 {

border: 2px solid red;

border-radius: 5px;

padding: 5px;

p.round2 {

border: 2px solid red;


border-radius: 8px;

padding: 5px;

p.round3 {

border: 2px solid red;

border-radius: 12px;

padding: 5px;

</style>

</head>

<body>

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

<p>This property is used to add rounded borders to an element:</p>

<p class="normal">Normal border</p>

<p class="round1">Round border</p>

<p class="round2">Rounder border</p>

<p class="round3">Roundest border</p>

</body>

</html>
DISPLAY PROPERTY

<!DOCTYPE html>

<html>

<head>

<style>

ul{

background-color: yellow;

li{

background-color: red;

border:1px solid black;

//display:inline-block;

//display:block;

display:inline;

height:50px;

width:50px;

</style>

</head>

<body>

<ul>

<li> Home </li>

<li> About us </li>

<li> Contact us </li>

</ul>

</body>

</html>
FLOAT PROPERTY

<!DOCTYPE html>

<html>

<head>

<meta name = "authors" content = "Balbharti">

<meta name = "description" content ="Advance web designing">

<meta name = "keywords" content ="html5, learn html5, list in html5">

<meta name="copyright" content= " copyright Balbharti All right Reserve">

<style>

img {

//float: right;

// float: none;

float: left;

</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>

LIST-STYLE-TYPE PROPERTY

<!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>
LIST-STYLE-POSITION

<!DOCTYPE html>

<html>

<head>

<title>CSS Lists</title>

<style>

.num{

list-style-type:decimal;

list-style-position:inside;

.roman{

list-style-type:lower-roman;

list-style-position:outside;

.circle{

list-style-type:circle;

list-style-position:inside;

.disc{
list-style-type:disc;

list-style-position:inside;

.square{

list-style-type:square;

list-style-position:inside;

</style>

</head>

<body>

<h1>

Welcome to CSS

</h1>

<h2>

Orderd lists

</h2>

<ol class="num">

<li>INSIDE</li>

<li>two</li>

<li>three</li>

</ol>

<ol class="roman">

<li>OUTSIDE</li>

<li>two</li>

<li>three</li>

</ol>

<h2>

Unorderd list</h2>

<ul class="disc">

<li>INSIDE</li>

<li>two</li>

<li>three</li>

</ul>
<ul class="circle">

<li>INSIDE</li>

<li>two</li>

<li>three</li>

</ul>

<ul class="square">

<li>INSIDE</li>

<li>two</li>

<li>three</li>

</ul>

</body>

</html>
LIST-STYLE-IMAGE PROPERTY

<!DOCTYPE html>

<html>

<head>

<style>

ul{

list-style-image: url('naruto.png');

</style>

</head>

<body>

<h2>CSS lists</h2>

<p>The list-style-image property specifies an image as the list item marker:</p>

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

</body>

</html>
REMOVE BULLETS, MARGIN AND PADDING FROM LIST

<!DOCTYPE html>

<html>

<head>

<style>

ul.demo {

list-style-type: none;

margin: 0;

padding: 0;

</style>

</head>

<body>

<p>Default list:</p>

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

<p>Remove bullets, margin and padding from list:</p>

<ul class="demo">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

</body>

</html>
LIST SHORTHAND PROPERTY

<!DOCTYPE html>

<html>

<head>

<style>

ul {

list-style: square inside url("naruto.png");

</style>

</head>

<body>

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

<p>The list-style property is a shorthand property, which is used to set all the list properties in one declaration.</p>

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

</body>

</html>

You might also like