Friday 23 August 2013

Better Blockquotes with css


A popular technique is to put large graphical Quotation marks at the upper left and lower right of the blockquote area. In these pre-CSS3, non-multiple-background days, there is no good way to do this without a little extra HTML. The easiest technique is to add a <span> element along with the <blockquote> element. Not ideal, but it works. You can apply most of the styling the blockquote element in your CSS and then set the second background image with the span. Upper left and lower right respectively.

Here are some examples:

Classy Quote



blockquote.style1 {
  font: 14px/20px italic Times, serif;
  padding: 8px;
  background-color: #faebbc;
  border-top: 1px solid #e1cc89;
  border-bottom: 1px solid #e1cc89;
  margin: 5px;
  background-image: url(images/openquote1.gif);
  background-position: top left;
  background-repeat: no-repeat;
  text-indent: 23px;
  }
  blockquote.style1 span {
     display: block;
     background-image: url(images/closequote1.gif);
     background-repeat: no-repeat;
     background-position: bottom right;
   }


Modern Quote



blockquote.style2 {
  font: 14px/22px normal helvetica, sans-serif;
  margin-top: 10px;
  margin-bottom: 10px;
  margin-left: 50px;
  padding-left: 15px;
  border-left: 3px solid #ccc;
}

Fun Quote


blockquote.style3 {
  font: 18px/30px normal Tahoma, sans-serif;
  padding-top: 22px;
  margin: 5px;
  background-image: url(images/openquote3.gif);
  background-position: top left;
  background-repeat: no-repeat;
  text-indent: 65px;
  }
  blockquote.style3 span {
    display: block;
    background-image: url(images/closequote3.gif);
    background-repeat: no-repeat;
    background-position: bottom right;
}

Fancy Quote


blockquote.style4 {
  font: 14px/20px italic Times, serif;
  padding-left: 70px;
  padding-top: 18px;
  padding-bottom: 18px;
  padding-right: 10px;
  background-color: #dadada;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  margin: 5px;
  background-image: url(images/openquote4.gif);
  background-position: middle left;
  background-repeat: no-repeat;
  text-indent: 23px;
}

Code Quote


blockquote.style5 {
  font: 12px/18px normal "Courier New", sans-serif;
  padding-left: 70px;
  padding-top: 2px;
  padding-bottom: 2px;
  background-color: #000;
  color: white;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  margin: 5px;
  background-image: url(images/openquote5.gif);
  background-position: middle left;
  background-repeat: no-repeat;
  text-indent: 23px;
  }
  blockquote.style5 div {
    padding-right: 50px;
    display: block;
    background-image: url(images/closequote5.gif);
    background-repeat: no-repeat;
    background-position: bottom right;
}

code blockquote









blockquote {
border : 2px solid #000;
width: 200px;
float: right;
margin: 0px;
padding: 10px;
background-color: #ccc;
quotes: "\201C" "\201D";
}
blockquote:before { content: open-quote; font-weight: bold; }
blockquote:after { content: close-quote; font-weight: bold; }

No comments:

Post a Comment

Silahkan Komen Rider,