Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS 3: Adding quote symbol to beginning of blockquote

Tags:

html

css

Can anyone tell me why this (also available live at http://jsfiddle.net/A2eTG/6/) renders a " symbol before the blockquote in Firefox but not Chrome/Safari?

blockquote
{
    padding: 0 60px;
    padding:10px;
    padding-left:55px;
}

blockquote:before {
    display: block;
    font-size: 700%;
    content: open-quote;
    height: 1px;
    margin-left: -0.55em;
    position:relative;
    top:-20px;
}

The blockquote:before selector shows up in Chrome's developer tools but doesn't appear on screen.

What gives?

like image 235
AgileMeansDoAsLittleAsPossible Avatar asked Jan 04 '11 19:01

AgileMeansDoAsLittleAsPossible


People also ask

How do you add quotation marks in CSS?

You can add quotation marks to a <blockquote> using CSS pseudo elements. The <q> element comes with quotation marks baked in so they need not be added, however adding them as pseudo-elements can be a workaround for older browsers that don't automatically add them.

How do I make a quote box in CSS?

The <div class="column-quote"> tag and its closing </div> tag create a container for the featured quote with the style rules you declared for the column-quote class in your styles. css file.

How do I style a blockquote in HTML?

The easiest way to style the blockquote tag: it consists in applying a shift, put the text in italics, and change the font.


3 Answers

I think the best solution would be

content: '“';
content: open-quote;

That way browsers that support open-quote would use it and ignore the earlier content value, while browsers that don't know what open-quote is will ignore that line and use the first one.

like image 52
Domenic Avatar answered Oct 30 '22 12:10

Domenic


To help others who came across this and want prettier quotes than ", these are the codes for double open, double closed, single open, and single closed quotation marks respectively: "\201C", "\201D", "\2018", "\2019".

like image 25
etcet Avatar answered Oct 30 '22 13:10

etcet


Looks like Chrome doesn't support content: open-quote. Try this instead:

content: "\""; 
like image 20
Brian Flanagan Avatar answered Oct 30 '22 13:10

Brian Flanagan