CSS Properties 02
CSS Properties 02
<!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>
<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-color: purple;
</style>
</head>
<body>
</body>
</html>
** TEXT-DECORATION-STYLE
<!DOCTYPE html>
<html>
<head>
<title> text-decoration-style</title>
<style>
h1 {
text-decoration-line: underline;
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>
</body>
</html>
**TEXT-DECORATION-THICKNESS
<!DOCTYPE html>
<html>
<head>
<title> text-decoration-thickness</title>
<style>
h1 {
text-decoration-line: underline;
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>
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-decoration: underline;
h2 {
h3 {
p{
</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 {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: lightblue;
</style>
</head>
<body>
<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 {
background-color: lightblue;
</style>
</head>
<body>
<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>
</style>
</head>
<body>
</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>
<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>
<!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>
<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>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
p{
border: 5px solid red;
</style>
</head>
<body>
</body>
</html>
ROUND BORDER
<!DOCTYPE html>
<html>
<head>
<style>
p.normal {
padding: 5px;
p.round1 {
border-radius: 5px;
padding: 5px;
p.round2 {
padding: 5px;
p.round3 {
border-radius: 12px;
padding: 5px;
</style>
</head>
<body>
</body>
</html>
DISPLAY PROPERTY
<!DOCTYPE html>
<html>
<head>
<style>
ul{
background-color: yellow;
li{
background-color: red;
//display:inline-block;
//display:block;
display:inline;
height:50px;
width:50px;
</style>
</head>
<body>
<ul>
</ul>
</body>
</html>
FLOAT PROPERTY
<!DOCTYPE html>
<html>
<head>
<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>
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>
<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>
<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>
<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>
<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 {
</style>
</head>
<body>
<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>