Neal Grosskopf Dot Com A NG Designs Site

Neal Grosskopf Dot Com Return To Neal Grosskopf's Home Page a NG Designs Site

Toolbar

  • Skip To
    • Menu
    • Content
  • Validate
    • HTML
    • CSS
    • WAI
  • Font Size
    • Small
    • Medium
    • Large
    • Extra Large
  • Account
    • Create Account
    • Login

Interact

Navigation

  • Home
  • Interact
    • Blog
    • Message Board
    • Open Links
    • Open Videos
    • Photo Gallery
    • Polls
    • Reviews
    • Geek Speak
  • Designs
    • View All Designs
    • Professional
    • Corporate
    • Templates
    • Personal
    • Club
    • NG Designs
    • Web Guides
  • Files
    • Artwork
    • Wallpapers
    • My File Downloads
  • Extras
    • Bookmarklets
    • The Magic 8-Ball
    • Career Builder RSS Feed Generator
    • Monster.com RSS Feed Generator

Create CSS Curly Quotes Without Images

  • Actions
    • View All
    • View Article Statistics
    • View User Statistics
    • Search
    • Subscribe to RSS Feed

Recent Articles:

  • Tracking Outgoing Links in Google Analytics Using Event Tracking and jQuery
  • Tracking Internal Website Campaigns With Google Analytics and PHP
  • Everything You Need to Know About jQuery's .data() Method
  • Google vs. China: How It Will Affect Web Workers
  • Don't Like The New Facebook Home Page? Fix It With 5 Lines of CSS
View All

Subscribe To Feed
loading Subscribers

I'm On Twitter loading

Oct 01

The objective of most web designers is to separate content from markup. It is also an objective to not use images when possible, simply for the fact that you have to edit the images in external software if you want to modify the look and feel them. Remember, if you can do it in CSS then do it in CSS. Below I will show you how to create CSS quotes without the need of images. The code is also pretty pure without the use of extra nested tags or classes.

Setting Up Your CSS Quotes

First, lets use the blockquote tag, because it is the most semantic choice when dealing with quotations. Also I should note that support for the Q element is not there yet in Internet Explorer so we will avoid that tag for now. The margin used, gives the blockquote some spacing much like a paragraph tag would, while the padding left offsets the content from our left quote.

blockquote { margin: 2em 0px; padding-left: 40px; }

Styling Our CSS Curly Quotes

Now we use the :before pseudo selector to place our CSS content. I changed the color, font family and gave it a negative margin which is the reverse of the padding we gave to the blockquote element. Next we use the HTML entity '201C' which will render as a quotation mark. We have to use this to get it working in Safari and Google Chrome.

blockquote:before { color: #990000; content: '201C'; /* http://monc.se/kitchen/129/rendering-quotes-with-css */ font-family: Arial, Helvetica, sans-serif; font-size: 6em; font-weight: bold; line-height: 0px; margin: 0px 5px 0px -40px; vertical-align: bottom; }

Putting It All Together

blockquote { margin: 2em 0px; padding-left: 40px; } blockquote:before { color: #990000; content: '201C'; /* http://monc.se/kitchen/129/rendering-quotes-with-css */ font-family: Arial, Helvetica, sans-serif; font-size: 6em; font-weight: bold; line-height: 0px; margin: 0px 5px 0px -40px; vertical-align: bottom; }

Click to view a demo of CSS curly quotes

Sources:

  • http://www.w3.org/TR/css3-selectors/#first-letter
  • http://www.w3schools.com/css/pr_gen_quotes.asp
  • http://developer.mozilla.org/En/CSS:content

Tags: css, quotes ( Add Tag )

Bookmark This Page:
  • Digg loading
  • Delicious loading
  • Re-Tweet loading
  • StumbleUpon loading
  • DZone loading
  • Snipplr
  • Script & Style

Replies:

  • Steve Olsen
    Steve Olsen
    #1

    Fri. March 27, 3:05:15 PM

    Cool beans! But I think it only works in Firefox (not IE or Chrome), from my quick tests anyways.
    Thanks, and good luck with life, my friend.

  • Neal Grosskopf
    Neal Grosskopf
    #2

    Sat. March 28, 12:03:24 AM

    Hi Steve, sorry about that, I've been meaning to update this article since I originally wrote it. I found a way to get it working in Safari and Google Chrome. I updated the article tonight with the proper CSS.

  • Trond t
    Trond t
    #3

    Tue. January 5, 2:42:21 PM

    I had to add an backslash, to get it work:
    content: '\201C'

  • Mike Dodge
    Mike Dodge
    #4

    Sun. May 2, 10:44:31 PM

    Thanks for that tip Trond. For some reason, it wouldn't work for me either until I added that backslash. I'll have to test this in the other browsers now.

  • Ant B
    Ant B
    #5

    Tue. May 4, 6:09:12 AM

    I also had to add the backslash to get it working. I would also like to point out that the codes are Unicode character codes (not HTML codes) and the closing quote (if you use blockquote:after) should be '\201D'.

  • Kylie R
    Kylie R
    #6

    Mon. July 12, 5:59:07 AM

    Glad I stumbled upon this post! I was using
    {content:open-quote;} which worked in IE and Firefox but not in Safari or Chrome. Substituting with '\201C' worked a charm. Thanks!


Reply:

B U I Link Font Color Edit Preview ?
Characters: 0 Textbox Size: [+] [-]
   

  • New Comment
    #7

    Sat. July 31, 1:14:45 PM

Font Size:

  • A
  • A
  • A
  • A

Search:

Places:

  • Blog
  • Message Board
  • Chat Room
  • Geek Speak
  • Open Videos
  • Reviews
  • Tag Cloud
 

Site Links

Site

  • About
  • Contact Me
  • Site Map
  • Site Search

Interact

  • Blog
  • Geek Speak
  • Message Board
  • Open Links
  • Open Videos
  • Photo Gallery
  • Polls
  • Reviews

Random Stuff

  • Hosting by FatCow
  • © Copyright 2005 - 2010
  • Modified: Friday, July 16, 2010
  • Load Time: 0.04 Seconds

Site Coded And Designed By Neal Grosskopf Using No Crappy CMS Or Themes