HTML / CSS Web Programming Interview Questions

Using browser default CSS, hyperlinks are displayed with a blue underline. Suppose you are writing a website and instead, you wish the default to be bold red font, with no underline. What would you put in your stylesheet?

Now suppose that when the user hovers their cursor above the hyperlink you want the text to turn green. What would you add to your stylesheet?

Suppose you have two CSS rule sets defined .bold {font-weight: bold; } and .bordered {border: 2px solid #CCC;} Write an additional rule-set that selects elements that are both .bold and .bordered and changes the font color to red?

Explore the basics of the display attribute:

  1. What are the possible values for the DISPLAY attribute?
  2. What's the default value?
  3. What the difference between display:none and visibility:hidden?

Explore the basics of the position attribute:

  1. What are the possible values for the POSITION attribute?
  2. What's the default value?
  3. How does the browser decide where to position absolute elements?

A user types the following URL into their browser: http://www.foo.com/bar.php

Explain in detail how this would cause a page to appear in their browser, with images, interactive elements (Ajax), styled paragraphs of text etc.

Given the following HTML:

<div class=”article”>
<h1>Buddy In-law</h1>
<p>A friend of a friend of yours. <a href=”https://www.google.com/?q=someone">Someone</a> you have yet to meet, but is friends with your friend. Someone you share a mutual friend with. Someone you share a mutual buddy with.</p>
</div>

How would you:
1. Change the paragraph font to Verdana?
2. Change the font size of the heading to a 20px
3. Change the font color of all anchors in article paragraphs to pink. Change the hover state color to red
4. Justify the paragraph text
5. Make the whole article 600px wide and center the heading