0% found this document useful (0 votes)
4 views5 pages

Css Lab Class3-5

Uploaded by

jemalmihretie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Css Lab Class3-5

Uploaded by

jemalmihretie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

 CSS Box Model

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

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

<title>CSS Box Model Example</title>

<style>

body {

display: flex;

justify-content: center;

align-items: center;

height: 100vh;

margin: 0;

background-color: #f0f0f0;

.box {

width: 200px;

height: 100px;

background-color: lightblue;

padding-top: 10px; /* Padding inside the element */

padding-right: 20px;

padding-bottom: 30px;

padding-left: 40px;

border-top: 5px solid darkblue; /* Border around the element */

border-right: 10px solid darkgreen;

border-bottom: 15px solid darkred;


border-left: 20px solid darkorange;

margin-top: 10px; /* Margin outside the element */

margin-right: 20px;

margin-bottom: 30px;

margin-left: 40px;

color: black;

font-family: Arial, sans-serif;

text-align: center;

</style>

</head>

<body>

<div class="box">This is the content area</div>

</body>

</html>
 CSS block and inline elements

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

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

<title>CSS block and inline elements Example</title>

<style>

*{

box-sizing: border-box;

h1{

text-align: center;

p{

display: inline;

font-size: 30px;

background-color: azure;

margin-right: 50px;

span{

display: block;

font-size: 30px;

background-color: bisque;

margin-top: 30px;

}
</style>

</head>

<body>

<div>

<h1>Display Property</h1>

<p> block: The element is displayed as a block.</p>

<p>inline: The element is displayed as an inline element.</p>

<span>inline-block: The element is displayed as an inline-level block


container.</span>

<span> none: The element is not displayed.</span>

</div>

</body>

</html>
 CSS float and clear Property
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS float and clear Example</title>
<style>
*{
box-sizing: border-box;
}
h1{
text-align: center;
}
.float{
float: right;
}
.clear{
clear:both;
}
</style>
</head>
<body>
<div>
<h1>Float and Clear Properties</h1>
<p class="float">float: Floats an element to the left or right.</p>
<p class="clear">clear: Specifies whether an element should be next to
floating elements or be moved down (none, left, right, both).</p>
</div>
</body>
</html>

You might also like