CSS Layout How to - Center quotation and hanging Punctuation without CSS3








Question

We would like to know how to center quotation and hanging Punctuation without CSS3.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
<!--from   w ww  . ja va  2  s.com-->
cite { 
   margin: 1em auto; 
   display: block; 
   text-align: right; 
   width: 20em; 
}
body blockquote {
    width: 20em;
    margin: 0 auto;
    border-width: 0 1px;
}

.punctuation-parent { 
    position: relative; 
}
.punctuation-parent .punctuation:first-child {
    position: absolute;
    top: 0;
    left: -0.6em;
} 
  </style>
</head>
<body>
  <blockquote class=punctuation-parent><p><b class=punctuation>"</b>
  this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. 
  <b class=punctuation>"</b></p></blockquote>
  <cite>from java2s.com</cite>
</body>
</html>

The code above is rendered as follows: