HTML Css Questions
HTML Css Questions
HTML Questions
1. What is HTML?
o Answer: HTML (HyperText Markup Language) is the standard markup language used
to create the structure of web pages.
o Answer: Tags are building blocks of HTML that define elements on a webpage, e.g.,
<p>, <div>, <h1>.
o Answer: <div> is a block-level element used for layout and grouping content, while
<span> is an inline element used for styling or grouping inline content.
o Answer: The <head> tag contains metadata, links to stylesheets, and scripts that do
not display directly on the webpage.
o Answer: Semantic HTML uses meaningful tags like <header>, <footer>, <article> to
improve accessibility and SEO.
o Answer: <iframe> embeds another HTML document within the current document.
o Answer: <ol> creates an ordered list (numbered), while <ul> creates an unordered
list (bulleted).
o Answer: An ID is unique and used once (id="header"), while a class can be reused
(class="btn").
12. What is the purpose of the alt attribute in the <img> tag?
o Answer: src is for embedding resources (e.g., images, scripts), while href is for linking
resources (e.g., CSS, links).
o Answer: Void elements do not have closing tags, e.g., <img>, <br>.
o Answer: It creates a form for user input, often used with <input> and <button> tags.
o Answer: It provides metadata like charset, viewport settings, and page description.
o Answer: <input> is for single-line input, while <textarea> is for multi-line text input.
20. What is the use of the action and method attributes in a <form>?
o Answer: action specifies where to send the form data, and method specifies how to
send it (GET or POST).
CSS Questions
23. What is the difference between relative, absolute, and fixed positioning in CSS?
o Answer:
o Answer:
29. What is the difference between inline, block, and inline-block elements?
o Answer:
30. What is the difference between position: static and position: relative?
o Answer: A tool (e.g., SASS, LESS) that adds advanced features like variables and
functions to CSS.
o Answer: They enable responsive design by applying styles based on device screen
size.
33. What is the difference between visibility: hidden and display: none?
o Answer:
o Answer: A layout system for creating complex designs using rows and columns.
o Answer: It specifies the stack order of elements; higher values are in front.
38. What is the difference between RGB and HEX color codes?
o Answer:
▪ RGB: Uses red, green, and blue values, e.g., rgb(255, 0, 0).
o Answer:
40. What are the differences between inline, internal, and external CSS?
o Answer:
o Answer: Use media queries, flexible layouts (Flexbox/Grid), and relative units like %,
em, rem.
o Answer:
o div {
o display: flex;
o justify-content: center;
o align-items: center;
o }
o Answer: sticky switches between relative and fixed based on the scroll position.
o Answer:
o body {
o background-image: url('image.jpg');
o }
o Answer: