Loading...

It’s time to check your understanding of margins, padding, and borders.

Before you take your quiz, work through the review activity below.

What style would you apply to a div so that the text inside it leaves 20px of space on the left?

  1. <div style="padding-left:20px;"></div>
    
  2. <div style="left-padding:20px;"></div>
    
  3. <div style="margin-left:20px;"></div>
    
  4. <div style="left-margin:20px;"></div>
    

Which code excerpt would successfully put 30px of space between two paragraphs?

  1. <p style="margin-bottom:15px;">Paragraph 1</p>
    <p style="margin-top:15px;">Paragraph 2</p>
    
  2. <p style="margin-bottom:30px;">Paragraph 1</p>
    <p>Paragraph 2</p>
    
  3. <p style="margin-bottom:10px;">Paragraph 1</p>
    <p style="margin-top:20px;">Paragraph 2</p>
    
  4. <p>Paragraph 1</p>
    <p style="margin-bottom:30px;">Paragraph 2</p>
    

Which styles would be needed to produce this border around a div?

  1. border:3px double #000000;
    
  2. border-left:medium dashed #000000; 
    border-top:medium dashed #000000; 
    border-bottom:medium dashed #000000;
    
  3. border:thick dotted #000000; 
    border-right:none;
    
  4. border:thin dashed #000000; 
    border-right:none;
    

What is the shortest way to correctly add a margin of 20px to the top and bottom and a margin of 10px to the left and right?

  1. margin-top:20px; margin-right:10px;
    margin-bottom:20px; margin-left:10px;
    
  2. margin:20px 10px 20px 10px;
    
  3. margin:10px 20px 10px 20px'
    
  4. margin:20px 10px;
    

You have a div in your layout that can take up 400px by 400px of space total. You'd like to fit four images into the div in a 2x2 grid. Each image is 175px by 175px, and each one has a 2px border around it. How much padding can you add to the div?

  1. <div style="padding:110px;"></div>
    
  2. <div style="padding:46px;"></div>
    
  3. <div style="padding:21px;"></div>
    
  4. <div style="padding:17px;"></div>
    

Summary

Questions answered correctly:

Questions answered incorrectly: