HTML (2)
HTML (2)
Benefits of html
User-friendly
Very lightweight
Easy to learn
Easy to integrate with all browsers
Tags:
Elements:
Attributes:
Structure Tags
● <!DOCTYPE>: Declares the document type and version of HTML
(e.g., HTML5).
● <html>: Represents the root of an HTML document; the container
for all content.
● <head>: Contains metadata, links to stylesheets, and scripts (not
visible to users).
● <body>: Represents the main content visible to the user.
Heading Tags
● <h1> to <h6>: Define headings, <h1> being the largest and <h6> the
smallest.
List Tags
Interactive Tags
Each of these tags has specific roles and can be combined to create
robust and interactive web pages. Let me know if you'd like examples for
any tag!
4o
Example:
html
Copy code
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>25</td>
</tr>
<tr>
<td>Jane</td>
<td>30</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">End of Table</td>
</tr>
</tfoot>
</table>
Example:
html
Copy code
<textarea rows="5" cols="30" placeholder="Enter your feedback
here"></textarea>
Example:
html
Copy code
<title>My Web Page</title>
Example:
html
Copy code
<u>This text is underlined</u>
List Tags
Example:
html
Copy code
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
What Are Selectors?
A selector in CSS is a part of the CSS ruleset, that is basically used to
select the
element you want to style. CSS selectors select HTML elements according
to
their id, class, type, attribute, etc.
Types of Selectors
There are various types of selectors in CSS. They are:
1. CSS Element / tag Selector
2. CSS Id Selector
3. CSS Class Selector
4. CSS Universal Selector
5. CSS Group Selector
Example:
css
Copy code
* {
margin: 0;
padding: 0;
}
Example:
css
Copy code
p {
color: blue;
}
3. Class Selector
Example:
css
Copy code
.box {
border: 1px solid black;
}
4. ID Selector
Example:
css
Copy code
#header {
background-color: lightgray;
}
5. Group Selector
Example:
css
Copy code
h1, h2, p {
font-family: Arial, sans-serif;
}
6. Descendant Selector
Example:
css
Copy code
div p {
color: green;
}
7. Child Selector
Example:
css
Copy code
ul > li {
list-style-type: square;
}
Example:
css
Copy code
h1 + p {
font-size: 14px;
}
Example:
css
Copy code
h1 ~ p {
color: gray;
}
Examples:
css
Copy code
a:hover {
color: red;
}
Examples:
Example:
css
Copy code
p::before {
content: "Note: ";
font-weight: bold;
}
Padding: Space between the text and the border inside the box.
7.
8. What is the float property in CSS and what is it
used for?
○ The float property is used to make an element float
to the left or right within its container, allowing other
content to wrap around it. It is often used for images
or text wrapping.
9. What is Flexbox, and how does it differ from CSS
Grid?
○ Flexbox is a one-dimensional layout system that
aligns items in a row or column.
○ CSS Grid is a two-dimensional layout system that
controls both rows and columns, offering more
complex layout capabilities.
Inline elements just take up the Block elements start on a new line and
space that is absolutely necessary consume the full width of the page
for the content and does not start available.
from a new line. Example:- <div>, <p>, <header>, <footer>,
Example:- <span>, <a>, <strong>, <h1>...<h6>, <form>, <table>, <canvas>,
<img>, <button>, <em>, <select>, <video>, <blockquote>, <pre>, <ul>, <ol>,
<abbr>, <label>, <sub>, <cite>, <figcaption>, <figure>, <hr>, <article>,
<abbr>, <script>, <label>, <i>, <section>, etc.
<input>, <output>, <q>, etc.
Metadata in HTML
Metadata is information that provides details about other data. In the context of
HTML,