HTML unit2-2
Drop-Down:-
A drop-down list in HTML is a list of items that appear when a user clicks on a drop-down button. You can create a drop-down list using the <select>
element. The options in the list are defined using the <option>
element.
Here's an example of a simple drop-down list:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Drop-Down</title>
</head>
<body>
<select>
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
</select>
</body>
</html>
output:-image-01
Margins and border:-
Margins:-
The HTML margin
property is used to define the outer space around an HTML element. The margin
property sets the margins for all four sides of an element (top, right, bottom, and left). The margin is the space outside of the border of an element, and it is used to separate an element from its surroundings.
You can set the margin
property for an HTML element in CSS using the following syntax:
element {
margin: value;
}
where element
is the selector for the HTML element you want to style and value
is the size of the margin. The value
can be specified in various units of measurement, such as pixels (px
), percentage (%
), or ems (em
).
You can also set the margin
property for individual sides of an element using the following syntax:
element {
margin-top: value;
margin-right: value;
margin-bottom: value;
margin-left: value;
}
Border:-
The HTML border
property is used to define a border around an HTML element. A border is a visual element that surrounds the content of an HTML element and separates it from other elements or the surrounding content.
You can set the border
property for an HTML element in CSS using the following syntax:
element {
border: width style color;
}
code:02
<!DOCTYPE html>
<html>
<head>
<style>
.body{
background-color: yellow;
}
div {
border: 1px solid black;
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: lightblue;
}
</style>
</head>
<body class="body">
<h2>Margins</h2>
<div>Top margin of 100px<br>Right margin of 150px<br>Bottom margin of 100px<br>left margin of 80px</div>
</body>
</html>
output:-image-02
Padding:-
The HTML padding
property is used to define the inner space around the content of an HTML element. The padding
property sets the padding for all four sides of an element (top, right, bottom, and left). The padding is the space inside of the border of an element, and it is used to separate the content of an element from its border.
You can set the padding
property for an HTML element in CSS using the following syntax:
element {
padding-top: value;
padding-right: value;
padding-bottom: value;
padding-left: value;
}
code:03
<!DOCTYPE html>
<html>
<head>
<style>
.body{
background-color: yellow;
}
div {
border: 1px solid black;
background-color: lightblue;
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
</style>
</head>
<body class="body">
<h2>padding properties</h2>
<div>Top padding of 50px<br>Right padding of 30px<br>Bottom padding of 50px<br>Left padding of 80px</div>
</body>
</html>
output:-image-03
Note:- the main margins,borders and padding most importing of web design
image-m-b-r
Text, Fonts, and Icons:-
In HTML, text, font, and icons are all important elements that contribute to the overall appearance and functionality of a website.
Text
is the primary means of conveying information and content on a website. HTML provides a number of tags for styling and formatting text, such as <p>
for paragraphs, <h1>
to <h6>
for headings, and <em>
for emphasis. The CSS font-family
, font-size
, font-weight
, and color
properties can be used to control the appearance of text.
Fonts
are an essential aspect of the visual design of a website. They help to establish a consistent look and feel, and can be used to set the tone and personality of a website. Web fonts can be imported and used in a website using the CSS @font-face
rule.
Icons
are small, scalable graphics that are used to enhance the visual design of a website, as well as to provide navigation and other interactive elements. Icons can be created using various tools and technologies, such as vector graphics editors, and they can be implemented in a website using HTML and CSS. There are also many libraries and collections of icons available online that can be used on a website.
code:04
<!DOCTYPE html>
<html>
<head>
<style>
.container {
width: 80%;
margin: auto;
padding: 20px;
border: 1px solid gray;
}
h1 {
font-family: Arial, sans-serif;
font-size: 36px;
font-weight: bold;
color: green;
}
p {
font-family: Verdana, sans-serif;
font-size: 14px;
color: black;
}
.icon {
width: 50px;
height: 50px;
background-image: url(icon.svg);
background-repeat: no-repeat;
display: inline-block;
}
</style>
</head>
<body bgcolor="yellow">
<div class="container">
<h1>Welcome to My Website</h1>
<p>This is a sample paragraph of text. It is used to demonstrate how text can be styled and formatted using HTML and CSS.</p>
<div class="icon"></div>
</div>
</body>
</html>
output:-image-04
Comments
Post a Comment