HTML tags are used to hold the HTML element. HTML element holds the content. HTML attributes are used to describe the characteristic of an HTML element in detail.
A block-level element always starts on a new line, and the browsers automatically add some space (a margin) before and after the element.
Ex: <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ul>, <ol>, <dl>, <pre>, <hr />, <blockquote> and <address>
Inline elements display in a line. They do not force the text after them to a new line.
Ex: <span>, <a>, <code>, <strong>, <img />, <cite>, <button>, <input />, <textarea>, <select>, <small>
A CSS property is an attribute that defines how an HTML element should be styled. CSS properties control various aspects of an element's appearance, such as its size, color, font, spacing, and more.
<p>This is a paragraph element.</p>
<p id="unique-paragraph">This paragraph has a unique ID.</p>
<p class="important">This paragraph has an important class.</p>
p {
color: blue;
}
#unique-paragraph {
font-weight: bold;
}
.important {
font-size: 18px;
}
<div class="container">
<p>This is a paragraph inside a container.</p>
</div>
.container p {
background-color: lightgray;
}
<div class="container">
<a href="#" class="link">Click me</a>
<div class="container">
<div></div>
a.link:hover {
text-decoration: underline;
}
<p>This is a <span>highlighted</span> text.</p>
p span::first-letter {
font-size: 24px;
font-weight: bold;
}
<input type="text" class="username" required>
<a href="https://example.com" target="_blank">Visit Example</a>
input[type="text"] {
border: 1px solid #ccc;
}
a[href^="https://"] {
color: blue;
}
The object-fit property is used to specify how an <img>
or <video>
should be resized to fit its container
Ex: object-fit: contain, cover, fill;
The object-position property of CSS specifies how an image or video element is positioned with x/y coordinates inside its content box.
Ex: object-position: bottom, left, right, top, center, inherit, initial;
The display property specifies the display behavior (the type of rendering box) of an element.
Ex: display: inline, block, inline-block, flex, grid, table;
initial - sets the property to its default value, as defined by the browser.
inherit - It is used to inherit the property from it’s parents’ elements.
vertical-align defines the vertical alignment for the content of a table cell or for an inline element against the rest of the inline flow.
Ex: vertical-align: top, bottom, middle, baseline;
Font fallback in the font-family property refers to specifying a list of fonts to be used as alternatives if the user's system does not have the first-choice font installed.
Ex: font-family: 'Roboto', 'Open Sans', Helvetica, Arial, sans-serif;
A semantic tag is like a special marker in HTML that makes content more meaningful. It tells browsers and developers what type of content it holds, making web pages easier to read and improving accessibility and help the search engines and other user devices to determine the importance and context of web pages.
Ex: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <p>, <ul>, <ol>, <li>, <table>, <caption>, <img>
In web development, a semantic element is like a labeled container that gives meaning to content. It helps browsers and search engines understand the structure and importance of the information on a webpage.
Ex: <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>