HTML stands for Hyper Text Markup Language. It is the standard markup language used for creating web pages. Markup language consists of markup tags and used to develop web pages. It is developed by W3C (World Wide Web Consortium) organization.
HTML5.2 is the current version of HTML.
HTML tags are like keywords. Each tag has a unique meaning. They begin with < symbol and end with > symbol. Whatever is written inside < and > are called tags. HTML tags are composed of three things: an opening tag, content, and an ending tag. Content is placed between tags to display data on the web page.
E.g.: <p> This is a paragraph </p>. A paragraph tag is used where <p> is the opening tag and </p> is the closing tag.
HTML attributes provide additional information about HTML elements. They are defined directly after the tag name. They only appear in opening tags and not in closing tags.
HTML elements are the building blocks of an HTML document, while HTML tags are the markers that define the beginning and end of an element. For example, <p> is an HTML tag, and everything between <p> and </p> is an HTML element.
No, there are some tags without closing tags like <br> tag to break the line, <img> tag for images, and <hr> tag to put the horizontal line, etc.
The basic structure of HTML is
<html>
<head>
<title> Title of the page </title>
</head>
<body>Content of the page</body>
</html>
Comments in HTML are added using the <!-- ... --> syntax. Anything between these tags will be treated as a comment and will not be rendered by the browser.
In HTML, formatting tags are used to apply specific styles and formatting to the content within them. Here are some of the commonly used formatting tags in HTML: <b>, <i>, <strong>, <em>, <u>, <small>, <sup>, <sub>, <mark>, <code>
There are six types of heading tags used in HTML from <h1> to <h6>. Each tag represents a different text size. <h1> is the largest heading tag and <h6> is the smallest one.
The bold tag <b> </b> or strong tag <strong> </strong> are used to bold the text in HTML.
Block-level elements start with a new line and take full width as a line. They have top and bottom margins. Examples of block-level elements are <div>, <table> etc
Inline elements do not start with a new line and take as much width as required. They do not have top and bottom margins. Examples of inline elements are <span>, <strong> etc
Anchor tag <a> </a> is used to create hyperlinks in HTML that link one webpage to another webpage.
Syntax
<a href =”url”> Link Text </a>
The href attribute is used in the anchor tag to specify the destination address of the link used.
These both tags are used to display images, but they serve different purposes and are used in different contexts.
<img>: The <img> tag is a void element used to embed images in an HTML document. The src attribute of the <img> tag specifies the URL of the image to be displayed.
<img src="https://cdn.pixabay.com/photo/2016/08/08/09/17/avatar-1577909_1280.png" alt="not found" width="500" height="500">
<figure>: The <figure> tag is a container element used to group an image with its related caption. To define the caption, you can use the <figcaption> element as a child of the <figure> element.
<figure>
<img src="https://cdn.pixabay.com/photo/2016/08/08/09/17/avatar-1577909_1280.png" alt="not found" width="500" height="500">
<figcaption>This is a User Placeholder Image</figcaption>
</figure>
The alt attribute provides alternative text for an image if it cannot be displayed.
The table tag <table> </table> is used to display data in tabular form. A table is a combination of rows and columns.
<table> It is used to define a table.
<tr> It is used to define a row in a table.
<th> It is used to define a header cell in a table.
<td> It is used to define a cell in a table.
<caption> It is used to define the table caption.
<tbody> It is used to define a group of body content in a table.
<thead> It is used to group the header content in a table.
<tfooter> It is used to group the footer content in a table.
In HTML, void elements, also known as self-closing elements or empty elements, are elements that do not have any content and do not require a closing tag. For example: <br>, <hr>, <input>, <img> etc.
You can insert a copyright using copy; or #169; in HTML.
The HTML character entities are used as a replacement for reserved characters in HTML. You can also replace characters that are not present on your keyboard by entities.
CSS stands for Cascading Style Sheet. It is used to style and layout web pages. It can control the layout of multiple web pages all at once. It is developed by W3C (World Wide Web Consortium) organization. Current version is CSS3.
No, CSS is case-insensitive. Even it is not dependent on font styles, or images on a website.
In CSS, !important is a special flag that can be added to a CSS rule to give it higher specificity and priority. When !important is used, it overrides any other conflicting styles, even if those styles have higher specificity or come later in the CSS file.
In CSS, the :root pseudo-class refers to the root element of the document, which is typically represented by the element. It is the highest-level element in the document hierarchy, and :root allows you to select and apply styles to this element.
The :root pseudo-class is useful for defining global CSS variables (custom properties) and setting default styles that will apply to the entire document.
When comparing the specificity of the :root pseudo-class and the tag selector, the tag selector has a lower specificity than the :root selector.
Here's an example of using :root to define CSS variables:
:root {
--primary-color: #007bff;
--font-size: 16px;
}
body {
font-size: var(--font-size);
color: var(--primary-color);
}
The best CSS frameworks are-
A CSS syntax consists of a selector, property, and value which is written as
selector {
property: value;
}
There are three ways to integrate CSS on a webpage.
Specificity is a concept in CSS that determines which styles are applied to an element when multiple conflicting styles are present. Inline styles have the highest specificity, followed by ID selectors, class selectors, and then element selectors.
CSS selectors are used to select the content you want to style. Selectors are the part of CSS rule set. CSS selectors select HTML elements according to its id, class, type, attribute etc. Different types of CSS selectors are
Descendant means anywhere nested within it in the DOM tree. Could be a direct child, could be five levels deep, it is still a descendant.
The Child selector (>) requires the element to be the next nested level down.
The "clearfix" technique is used to clear floats and ensure that a container properly contains its floated child elements. It prevents collapsing margins and ensures proper layout when elements are floated.
The ID selector targets a single HTML element with a specific ID attribute. It is denoted by a hash (#) followed by the ID name. Example-
#container {
width: 960px;
}
The class selector targets HTML elements with a specific class attribute. It is denoted by a dot (.) followed by the class name. Example-
.box {
padding: 10px;
margin: 10px;
}
Class is a way of using HTML elements for styling. They are not unique and have multiple elements whereas ID is unique and it can be assigned to a single element.
In CSS, a vendor prefix (also known as a browser prefix) is a string of characters added to the beginning of a CSS property or value to enable experimental or non-standard features in specific web browsers. These prefixes were introduced to allow browser vendors to implement and test new CSS features before they become fully standardized and supported by all browsers.
Vendor prefixes typically consist of the browser's name or abbreviation followed by a hyphen. Here are some common vendor prefixes:
/* Without prefixes (standard) */
div {
transform: translateX(50px);
}
/* With prefixes (browser-specific implementations) */
div {
-webkit-transform: translateX(50px); /* Chrome and Safari */
-moz-transform: translateX(50px); /* Firefox */
-ms-transform: translateX(50px); /* Internet Explorer and Edge */
-o-transform: translateX(50px); /* Opera */
}
The box model is a fundamental concept in CSS that defines how elements are displayed in rectangular boxes. It consists of content, padding, border, and margin. The total width and height of an element are calculated by adding the content width/height, padding, border, and margin.
margin: It is used to create space around elements, outside of any defined borders.
padding: It is used to create space around an element's content, inside of any defined borders.
Pseudo-elements target specific parts of an element's content, such as the first line, first letter, or even generated content. Examples of pseudo-elements are
Pseudo-classes select regular elements under specific conditions such as when a user is hovering over a link. Examples of pseudo-classes are:
The z-index helps to specify the stack order of positioned elements that may overlap one another. The default value of z-index is zero and can take on either a positive or negative number. An element with a higher z-index is always stacked above a lower index.
visibility: hidden hides the element, but it occupies space and affects the layout of the document.
display: none also hides the element but does not occupy space. It will not affect the layout of the document.
In CSS, border-box and content-box are two different values for the box-sizing property, which determines how the total width and height of an element are calculated.
content-box: This is the default value for the box-sizing property. When an element has box-sizing: content-box, the width and height of the element are calculated based on the content's size, excluding the padding and border.
border-box: When an element has box-sizing: border-box, the width and height of the element include the content's size, padding, and border. In other words, the specified width and height will include the total space taken up by the element, including the padding and border.
No, margin-top or margin-bottom does not affect the inline elements.
CSS media queries play a crucial role in responsive design, as they allow you to apply different CSS styles based on the characteristics of the user's device or screen.
Here's how you can create a responsive layout using CSS:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
/* Default styles for all screen sizes */
.element {
background-color: blue;
}
/* Media query for screens with a maximum width of 768px (mobile devices) */
@media screen and (max-width: 768px) {
.element {
background-color: red;
}
}
/* Media query for screens with a minimum width of 1200px (large desktops) */
@media screen and (min-width: 1200px) {
.element {
background-color: green;
}
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.item {
flex: 0 0 calc(33.33% - 10px);
}
Copyright © 2023 - Proleed Academy | All Rights Reserved.