Interview Questions
How can CSS be integrated into an HTML page?
There are three ways of integrating CSS into HTML: using style tags in the head section, using inline-styling, writing CSS in a separate file, and linking into the HTML page by the link tag.
Explain a few advantages of CSS.
With CSS, different documents can be controlled using a single site, styles can be grouped in complex situations using selectors and grouping methods, and multiple HTML elements can have classes.
How can you target h3 and h2 with the same styling?
Multiple elements can be targeted by separating with a comma: h2, h3 {color: red;}
Name media types allowed by CSS.
The different media types allowed by CSS are: speech audio visual tactile media continuous or paged media grip media or bitmap interactive media
How can you use CSS to control image repetition?
The background-repeat property is used to control the image. Example: h3 { background-repeat: none; }
Name some font-related CSS attributes.
The font-related attributes are Font- style, variant, weight, family, size, etc.
What are the limitations of CSS?
CSS cannot always assure compatibility with every browser; you need to be cautious while choosing the style selector. The parent selector tag is not available, thus you can?t select the parent selector tag. Some selectors can lead to cross-browser issues due to their less browser-friendly behavior. We cannot request a webpage through CSS.
How to include CSS in the webpage?
With the help of a link tag, you can include an external style sheet file as a CSS file into your HTML file. 1.You can add CSS styles included within your HTML page and write it in the stand-alone stylesheet form of CSS. 2.CSS can be included directly in the HTML tag by adding an inline style to HTML elements. 3.One can import an external stylesheet file as a new CSS file by using the @import rule.
What are the different types of Selectors in CSS?
Universal Selector, Element type Selector, ID selector, Class selector, Descendant combinatory, Child Combinator, General Sibling Combinator, Adjacent sibling combinator, and Attribute selector.
What is a CSS Preprocessor? What are Sass, Less, and Stylus? Why do people use them?
CSS preprocessor is a tool used to enhance the basic functionality and let us use the complex logical syntax such as variables, functions, mixins, and code nesting within vanilla CSS scripts themselves. Sass (Syntactically Awesome Style Sheets) uses .sass extension. It is used for indentation; it doesn?t use semicolons or curly brackets. Less (Leener Stylesheets) uses .less extension. It is easy to add to any JavaScript Project by using NPM or less.js file. Here, @ is used to define the variables. Stylus provides great flexibility in writing syntax. It is able to use native CSS as well as the exclusion of brackets, colons, and semicolons. There is no need to use @ or $ to define the variables. People use SASS, LESS, and Stylus in order to extend the basic functionality of vanilla CSS.
Tell us something about CSS3.
CSS3 is divided into modules and is supported by almost every browser. Many graphics-related characteristics are introduced in CSS3 like box-shadow, Border-radius, and flexbox. A user can create precise multiple background images using properties like background-position, background-repeat, and background-image styles.
How is a CSS selector used?
With a CSS selector, we can choose the content we want to style to bridge between HTML files and style sheets. CSS selector syntax is "select" HTML elements created on their class, id, type, etc.