Complete HTML and CSS Course
HTML Tags:
<html>: Defines an HTML document.
<head>: Contains meta-information about the document.
<title>: Defines the title of the document.
<body>: Defines the document's body, where content is displayed.
<h1>: Defines the largest heading.
<p>: Defines a paragraph.
<a>: Defines a hyperlink.
<img>: Defines an image.
<ul>: Defines an unordered list.
<ol>: Defines an ordered list.
<li>: Defines a list item.
<div>: Defines a division or section.
<span>: Defines a small section of text.
<table>: Defines a table.
<tr>: Defines a table row.
<td>: Defines a table cell.
<th>: Defines a table header.
<form>: Defines an HTML form for user input.
<input>: Defines an input field in a form.
<button>: Defines a clickable button.
CSS Properties:
color: Sets the text color.
background-color: Sets the background color of an element.
font-size: Sets the font size of the text.
font-family: Sets the font of the text.
text-align: Sets the horizontal alignment of the text.
margin: Sets the margin around an element.
padding: Sets the padding inside an element.
border: Sets the border around an element.
display: Defines how an element is displayed.
position: Defines the positioning method for an element.
width: Sets the width of an element.
height: Sets the height of an element.
box-shadow: Adds shadow effects around an element.
opacity: Sets the opacity level of an element.
z-index: Sets the stacking order of positioned elements.
30 HTML & CSS Interview Questions & Answers:
Q1: What is the difference between HTML and XHTML? HTML is a markup language used to create
web pages, while XHTML is a stricter version of HTML that follows XML rules.
Q2: What are the types of CSS? CSS can be applied in three ways: inline, internal, and external.
Q3: What is the box model in CSS? The box model describes the rectangular boxes generated for
elements in the document tree, including margins, borders, padding, and the content.
Q4: What are media queries in CSS? Media queries allow you to apply styles based on the
viewport's dimensions, orientation, and other factors.
Q5: How does the CSS 'float' property work? The float property is used to position elements to the
left or right, allowing text or inline elements to wrap around them.
Q6: What is the difference between 'position: relative' and 'position: absolute'? 'relative' positions an
element relative to its normal position, while 'absolute' positions an element relative to its nearest
positioned ancestor.
Q7: What is the 'display' property in CSS? The display property specifies how an element should be
displayed, such as block, inline, flex, or grid.
Q8: What is the difference between 'id' and 'class' in HTML? 'id' is unique and can be applied to one
element, while 'class' can be applied to multiple elements.
Q9: What is the CSS 'flexbox' layout? Flexbox is a one-dimensional layout method for arranging
elements within a container, either in rows or columns.
Q10: What is the 'z-index' property in CSS? The z-index property controls the vertical stacking order
of elements that overlap.