Responsive Web design interview questions

September 22, 2014
Exercises To Do
Class Selector

dummy text

No matter what type of programming position you’re interviewing for, chances are you’ll likely need at least some basic familiarity with front-end design languages, including CSS. With front end designers pulling in a median income of $63/k per year, and some into the six figure range, there’s ample incentive to pursue web design and development as a career. Whether you’re a seasoned pro prepping for an interview or just trying to gain a foothold in the industry, it’s worth it to have a glance at some of the most common CSS interview questions and identify any gaps in your knowledge base.

If you’re a CSS pro, some of these questions might come off as a bit basic. However, they cover most of the core CSS concepts and principles and will serve as a good refresher if you’re a developer who doesn’t utilize it on a day to day basis.

In any case, knowing and understanding how to use something is only half the battle. Being able to clearly and concisely describe and discuss a complex topic is another ballgame entirely, and something employers will look at to gauge your communications skills.

So, before you head into your next developer or designer interview, take a look below and make sure you’re up to speed with these CSS interview questions and answers!


Explain what a class selector is and how it’s used:

  • A class can be thought of as a grouped collection of CSS attributes applied to HTML elements. This allows you to apply the same styling to multiple HTML elements by placing them in the same CSS class.
  • Class methods can be called by inserting a ‘class’ property and name within an HTML element, then calling the class name with a ‘.’ in the CSS doc.
  • Class syntax:
  • Within an HTML doc:

    Within a CSS doc:

  • The code listed here identifies the class ‘intro’ in the HTML doc, then applies the same background-color styling to all paragraphs within that class.
  • What are pseudo classes and what are they used for?

  • Pseudo classes are similar to classes, but are not explicitly defined in the markup, and are used to add additional effects to selected HTML elements such as link colors, hover actions, etc.
  • Pseudo classes are defined by first listing the selector, followed by a colon and then pseudo-class element. E.g., a:link{ color: blue }, or a:visited { color: red }
  • Class Selectorselector:pseudo-class {

  • Syntax for using a pseudo class within a CSS class:
  • selector.class:pseudo-class {

  • :link, :visited, :hover, :active, :first_line are all examples of pseudo classes, used to call a specific action on an element, such as the changing of a link color after it has been visited.
  • Explain the three main ways to apply CSS styles to a Web page:

  • Inline: Though this method often goes against best practices, it’s easily done by inserting a ‘style’ attribute inside an HTML element:
  • e.g.)

    Lorem Ipsum

  • Embedded/Internal: Done by defining the head of an HTML document by wrapping characteristics in a tag.
  • Linked/External: CSS is placed in an external .css file, and linked to the HTML document with a tag. This can also be accomplished using the ‘@import’, however, this can slow page load time and is generally not advised.
  • What is grouping and what is it used for?

  • Grouping allows you to apply the same style to multiple elements with a single declaration. This is done by grouping the selectors into a list, separated by commas.
  • e.g.) h1, h2 { font-family: Helvetica; font-size: 20; }

  • Grouping helps memory usage and enhances readability.
  • What is an ID selector and how is it used?

  • IDs are used to identify and apply styling to a single specific HTML element. IDs are defined within the HTML page by inserting an ID selector in the HTML element:
  • ID selectors are defined within the CSS page by calling a ‘#’ followed by the name of the ID:
  • ID selectors are unique and can only be applied to a single element.
  • html-css-coding-screenshotWhat is a Class selector and how does it differ from an ID selector?

  • Class selectors are used to apply style to multiple HTML identified with the same class.
  • Class selectors are called within the CSS document by a ‘.’, followed by the class name:
  • The main difference is that the same class selector can be applied to multiple HTML elements, whereas ID selectors are unique..
  • What are child selectors?

  • Child selectors are another way to group and style a set of elements that descend from a parent element.
  • A child selector is matched by calling two or more elements, separated by a ‘>’ sign to indicate inheritance.
  • e.g.)

  • In this example, the same styling would be applied to all paragraphs within the body.
  • What are the different CSS properties used to change dimensions and what values can they accept?

  • height: Sets a specific height
  • width: Sets a specific width
  • max-height: Sets a maximum height
  • max-width: Sets a maximum width
  • min-height: Sets a minimum height
  • min-width: Sets a minimum width
  • How is the float property implemented in CSS?

  • Floats allow an element to be positioned horizontally, allowing elements below the floated element to flow around it. Several floating elements can be placed together to make a gallery type layout.
  • Floats can only accept a left or right value.
  • HTML CSS Codingimg {
    float: right;
    margin: 5px;

  • To prevent subsequent elements from flowing around the floated element, pass in the clear property, followed by the side you wish to disable (i.e., ‘left’, ‘right’, ‘both’).
  • What is the CSS Box Model used for? What are the elements that it includes?

  • CSS box model is made up of margins, borders, padding, and content.
  • Box model provides a structured way to space elements in relationship to each other.
  • How to restore the default property value using CSS?

  • In short, there’s no easy way to restore to default values to whatever a browser uses . The closest option is to use the ‘initial’ property value, which will restore it to the default CSS values, rather than the browser’s default styles.
  • What is the purpose of pseudo-elements and how are they made?

  • Pseudo elements are made using a double colon (::) followed by the name of the pseudo element.
  • Pseudo-elements are used to add special effects to some selectors, and can only be applied to block-level elements.
  • Most commonly used pseudo-elements are ::first_line, ::first_letter, ::before, ::after
  • How are inline and block elements different from each other?

  • A block element is an element that takes up the full width available, and has a line break before and after it.
  • What is the purpose of the z-index and how is it used?

  • The z-index helps specify the stack order of positioned elements that may overlap one another. The z-index default value is zero, and can take on either a positive or negative number.
  • An element with a higher z-index is always stacked above one with a lower index.
  • Z-Index can take the following values:
  • Auto: Sets the stack order equal to its parents.

    Responsive Web Design Tutorial - 3 - Why Percentages Dont Suck
    Responsive Web Design Tutorial - 3 - Why Percentages Dont Suck
    Responsive Web Design Tutorial - 2 - Why Pixels Suck
    Responsive Web Design Tutorial - 2 - Why Pixels Suck
    Responsive Web Design Tutorial - 5 - Images
    Responsive Web Design Tutorial - 5 - Images
    Share this Post