0% found this document useful (0 votes)
7 views2 pages

HTML Intv

The document explains the structure of HTML, including the doctype declaration, the role of <head> and <body>, and the differences between various HTML elements like <span> and <div>. It also covers CSS selectors, their types, and how to use media queries for responsive design, as well as the concept of Web Storage and the use of the '!important' rule in CSS. Key distinctions between ID and class selectors, as well as the differences between <datalist> and <select> elements, are also highlighted.

Uploaded by

seikhabubakar
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)
7 views2 pages

HTML Intv

The document explains the structure of HTML, including the doctype declaration, the role of <head> and <body>, and the differences between various HTML elements like <span> and <div>. It also covers CSS selectors, their types, and how to use media queries for responsive design, as well as the concept of Web Storage and the use of the '!important' rule in CSS. Key distinctions between ID and class selectors, as well as the differences between <datalist> and <select> elements, are also highlighted.

Uploaded by

seikhabubakar
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/ 2

What is the structure of HTML?

The What is the difference between ID and


structure of HTML consists of a doctype class selectors?
declaration, a root <html> element,
An ID selector uses the # symbol followed
and nested head and body
by a unique identifier to style a specific
sections.<head> contains metadata like
HTML element.>>It should be used when
title, styles, and links. <body> holds all the
you want to apply styles to one unique
visible content such as text, images, and
element on a page, like #header or #main.
layout elements.
HTML elements are structured using tags A class selector uses the . symbol followed
with opening and closing pairs to define by the class name to style multiple
content blocks. elements that share the same class.>>It is
ideal for applying common styles to groups
What is a DOCTYPE declaration, and
of elements, such as .button, .card,
why is it used in an HTML
or .highlight.
documentThe DOCTYPE declaration is the
first line in an HTML document and tells the What are HTML attributes? Give an
browser which HTML version is being example.?HTML attributes provide
used.It helps the browser render the page additional information about elements
correctly by enabling standards mode. and are always specified in the opening
In HTML5, it is written as <!DOCTYPE tag.
html>. They usually come in name="value" pairs,
Without it, browsers may switch to quirks such as href, src, alt, id, or class.
mode, causing inconsistent page display. Ex: <a href="https://example.com">Visit
How is the <span> element different Site</a> – here, href is an attribute.
from the <div> element? Difference between <datalist> and
<select> elements.? The <select>
The <span> element is an inline element
used to style small portions of text or element creates a dropdown menu where
content.>>The <div> element is a block- users can choose from predefined options
level element used to group larger sections only.>>The <datalist> element provides
of content or layout.<span> does not start autocomplete suggestions while still
on a new line, while <div> always starts on allowing users to enter custom
a new line.>>Both are non-semantic, input.<datalist> is used with an <input>
meaning they don’t convey meaning about element, while <select> works
their content. independently.
Explain CSS selectors and their types.? What is the correct method for
CSS selectors are patterns used to select selecting a class in CSS? The correct
and style specific HTML elements.>>They method for selecting a class in CSS is by
target elements based on tag name, class, using a dot (.) followed by the class name.
id, attributes, and more. Example: .menu { color: blue; } – this
Types selectors->>Universal Selector applies the style to all elements with the
(*) – selects all elements.>>Element class menu.
Selector (p, h1, etc.) – selects all What are the different position
elements of a specific type.>>Class properties in CSS? static – Default
Selector (.class) – selects elements with a positioning; elements follow the normal
specific class.>>ID Selector (#id) – flow of the page.relative – Positioned
selects a single element with a specific relative to its normal position; can be
ID.>>Attribute Selector ([type="text"]) shifted using top, right, bottom, and
– targets elements by attributes.>>Group left.absolute – Positioned relative to the
Selector (h1, nearest positioned ancestor or the initial
p)>>Descendant/Child/Adjacent containing block. fixed – Positioned relative
Sibling Selectors to the viewport; stays fixed during scrolling.
sticky – Switches between relative and
fixed based on the scroll position.
Discuss how to use media queries for
different devices in CSS. Media queries
in CSS allow you to apply different styles
based on device characteristics like screen
size, resolution, or orientation. Mobile
phones (up to 600px)>> Tablets (601px to
900px)>> Laptops and desktops (901px
and above).
What is Web Storage, and what are its
types? Web Storage is a way for web
browsers to store data locally on a user’s
device, allowing websites to save
information without using cookies.It
provides more storage capacity and better
performance for client-side data
handling.LocalStorage – Stores data with no
expiration; data persists even after the
browser is closed.SessionStorage – Stores
data only for the duration of the page
session; data is cleared when the tab or
browser is closed.
Why is the ‘!important’ used in CSS?
The !important rule in CSS is used to force
a style to override any other conflicting
styles>>It makes a CSS declaration the
highest priority

You might also like