Q. What is an id selector?
A. You can define style rules based on the id attribute of the elements. All the elements having that id will be formatted according to the defined rule.
Q. What is CSS Box Model?
A. CSS Box Model includes content, margin, padding, and border. Total width is equal to width + padding + margin + border. These properties occupy space on the box model.
Q. Difference between Position Relative, Absolute, and Fixed
A. Position relative can move an element with respect to its current position.
Position absolute can move an element with respect to its current position or parent elements position. Absolute Elements doesn't occupy space in DOM Flow.
Position fixed gives a fixed position to an element with respect to the device screen. These elements don't move on scrolling. Fixed Elements also doesn't occupy space in DOM Flow.
Q. Explain the difference between visibility: hidden and display: none?
A. visibility: hidden simply hides the element, while it will still take up space and affect the layout of the document.
display: none also hides the element, but will not take up space, and the page will appear as if the element is not present.
Q. How to overrule underlining Hyperlinks?
A. using: -- a { text-decoration: none;}
Q. What is meant by responsive web design?
A. Responsive design is an approach to web page creation that makes use of flexible layouts, flexible images, and cascading style sheet media queries. The goal of responsive design is to build web pages that detect the visitor's screen size and orientation and change the layout accordingly.
Q. What is Viewport meta in html5 and why do we use it?
A. The viewport is the user's visible area of a web page. The viewport varies with the device and will be smaller on a mobile phone than on a computer screen. Before tablets and mobile phones, web pages were designed only for computer screens, and it was common for web pages to have a static design and a fixed size.
<meta name="viewport" content="width=device-width, initial-scale=1">