Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a FontAwesome character to the beginning of all blockquotes?

I am using FontAwesome. Right now I have a blockquote which has an image in front of it that shows its a quote mark.

blockquote {
    background-image: url("./styles/roman/imageset/forum/quote.gif");
    background-attachment: scroll;
    background-position: 6px 8px;
    background-repeat: no-repeat;
    border-color: #dbdbce;
    border: 1px solid #dbdbdb;
    font-size: 0.95em;
    margin: 0.5em 1px 0 25px;
    overflow: hidden;
    padding: 5px;
}

FontAwesome has a quote mark in their font, I was wondering if there is a way to change it from currently being a background to just showing the character. I did not know if using content and a font type would work.

Example

["] This is a quote for whatever magazine.

where ["] is currently the quote image.

like image 391
Case Avatar asked Oct 24 '25 05:10

Case


2 Answers

You can use the CSS pseudo-selector ::before.

For your example you would use:

blockquote::before {
  content: '\"';
}

For further reference, see here.

If you wish to include the icon from the FontAwesome library, you can try with the following:

blockquote::before {
  font-family: FontAwesome;
  content: '\f10d'; /*quote left icon*/
}
like image 90
Daniel Higueras Avatar answered Oct 26 '25 21:10

Daniel Higueras


You can use a ::before pseudo-element with content: open-quote to insert an opening quote, and an ::after one with content: no-close-quote to decrement the quote nesting level without displaying any quote.

If you want to customize the quotation marks, use the quotes property. According to A list of Font Awesome icons, fa-quote-left is \f10d and fa-quote-right is \f10e.

Finally, to display that character using in the appropriate font, use font-family: FontAwesome.

blockquote { quotes: "\f10d" "\f10e" '“' '”' "‘" "’"; }
blockquote::before { content: open-quote; font-family: FontAwesome; }
blockquote::after  { content: no-close-quote; }
<link href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" rel="stylesheet"/>
<blockquote>
  Hello world!
  <blockquote>Foo bar<blockquote>Baz</blockquote></blockquote>
</blockquote>
like image 28
Oriol Avatar answered Oct 26 '25 20:10

Oriol