Attention Future Programmers: Here Are 10 CSS Interview Questions and Answers


According to Wikipedia, Cascading Style Sheets—or CSS—is “a style sheet language used for describing the presentation of a document written in a markup language.” It is the basis for a multitude of applications—and as proof of that fact, it is referenced three separate times in our article listing Bootstrap Framework interview questions.

As I’ve stated in our list of SQL questions and answers, millennials are technically inclined and primed to land a job that utilizes any aspect of computer programming or coding. CSS—due to its popularity amongst programmers—provides hosts of job opportunities. If you’re looking to break into the field, here are a few interview questions and answers to get you started.

Our first set of questions, provided by, cover fundamental CSS terminology.

Q: What are the components of a CSS Style Rule?
A: A Style Rule is made of three parts:

  • Selector− A selector is an HTML tag at which a style will be applied. This could be any tag like <h1> or <table> etc.
  • Property− A property is a type of attribute of HTML tag. Put simply, all the HTML attributes are converted into CSS properties. They could be color, border etc.
  • Value− Values are assigned to properties. For example, color property can have value either red or #F1F1F1 etc.

Q: What is a type selector?
A: Type selector matches the name of an element type.

Q: What is a universal selector?
A: The universal selector matches the name of any element type, rather than selecting elements of a specific type.

The next set of questions is provided by—and also test your knowledge of CSS terms.

Q: What is a class selector?
A: A class can be thought of as a grouped collection of CSS attributes applied to HTML elements.

Q: What are pseudo classes?
A: Pseudo classes are similar to classes, but are not explicitly defined in the markup.

Q: What is an ID selector?
A: IDs are used to identify and apply styling to a single specific HTML element.

The next set of questions—also courtesy of—ask for proper CSS methodology.

Q: Why shouldn’t I use fixed sized fonts?
A: Fixed font sizes will regularly show up incorrectly on the user end and will prohibit responsiveness. Using relative sizing will keep fonts proportionate in their relationships to each other and will allow for greater end user flexibility.

Q: Why and how are shorthand properties used?
A: Using shorthand properties can improve page load times and reduce file size. Shorthand can be utilized with background, font, border, padding, outline and list-style properties. Shorthanding is accomplished by listing the property values on a single line, in a specific order.

TechRepublic hosts the next two questions—which deal with specific CSS commands.

Q: What does the following CSS do?
P {font-family: Verdana, Arial, Helvetica;}
A: The CSS sets the font for the P element. If available in the browser, Verdana is used. If Verdana is not available, Arial is used. If Arial is not an option, Helvetica is used.

Q: How do you include comments in CSS?
A: Anything placed between /* and */ in CSS is considered a comment. The browser ignores comments.

The final question of this set (call it a bonus question)—also provided by TechRepublic—is an open-ended question. I’ve chosen to include it as open-ended CSS related questions appear on all of the websites here and are essential to your successful interview. The answer written here can be used as a guide.

Q: Have you utilized any CSS libraries or frameworks?
A: The answer to this question will not be standard, but it gives you an idea of a candidate’s familiarity with the landscape. Possible answers include the YUI Library or YAML, but there are plenty more out there.

When embarking on your CSS interview, questions of every variety exemplified here will be thrown at you. These questions are an excellent starting point—and all of the websites cited here can guide you further.


About Author

Mary Grace holds a Master of Arts in Public Communications and Media Studies from Fordham University, and a Bachelor of Arts in Communication Studies from Salve Regina University. She spends her time in the editorial department at the National Association of Professional Women by day, and is a community thespian and wannabe politician and activist by night. Her favorite things include trips to Walt Disney World, drinking too much coffee, browsing Sephora, her Apple Watch and her "nephew," Luis.

Leave A Reply

four − 3 =