Switch to full style
HTML code examples
Post a reply

Change the margin and padding of paragraph

Thu Feb 23, 2012 12:52 pm

In this code we use CSS attributes to change the margin and the padding of two paragraphs .

Code:


<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Change the margin and the padding of the paragraph</title>
<
style type="text/css">

p.parah1 {
 
 margin
: 20px 21px 32px 0;
 padding: 0;
  border:1px dashed green;
}
p.parah2 {
 
 margin
: 0 3px 5px 2px;
 padding: 40px;
 border:1px solid red;
}

   

</style>
</
head>

<
body>
  <h1>Header Title</h1>

  

  
<p class="parah1" >This is the first paragraph , notice the margin configuration.</p>

<
p  class="parah2" > This is the second paragraph; CSS margin attribute takes the affects. </p>
</
body>
</
html>
 




Post a reply
  Related Posts  to : Change the margin and padding of paragraph
 change background of the paragraph     -  
 Change the word spacing in paragraph     -  
 Change the text indent in the paragraph     -  
 set margin to body tag     -  
 adding padding to your text     -  
 id Selector with paragraph     -  
 hide paragraph using jquery     -  
 Setting maximum height of paragraph -P tag     -  
 enlarge first letter in html paragraph     -  
 Changing the line height of the paragraph     -  

Topic Tags

HTML Paragraph