Skip navigation.

exploreopera

| Help

Sign up | Help

Caffeine

The daily grind and then some

More CSS Tricks

, , ,

This next bunch of CSS style tips might look tricky but honestly there isn’t much to worry about. When you open up a magazine, quite often you see some pretty neat ways to draw your attention to a quote from the article itself; this is called a “pull quote” and using CSS you can do the same thing on your blog pages.
...this will look like some of the pullquotes or subtitles you see in magazines

The jagged edge is intentional. This is using a right alignment. This is nothing more than a div with some styling and anyone can do this easily.

Copy the code below into your own blog and check it out. You can "float" your text "left" or "right", change the width of the overall quote, change its colours to match your page, align your text, pretty much anything you want to do.
<div style="float:right;width:150px;
margin-top:15px;
margin-bottom:15px;
margin-left:10px;
padding-bottom:10px;
font-family:Arial, Helvetica, Georgia;
font-size: 28px;
line-height:24px; 
color:#FF6600; 
text-align: right;">
<span style="color:gold;">...this will </span> 
look like some of the  <b>pullquotes or subtitles you see</b> in 
<span style="color:gold;">magazines</span>
</div>
Another style of "pull quote" is an inline box. Again there is nothing difficult about these they are nothing more than divs on your page.

Inline Pull Quotes
You don't have to define the pullquotes in the style sheet. The code is short and doesn't use too many keystrokes. It's just another paragraph in CSS.

As you can see, there is nothing tricky about this at all. The code itself is a single line and it really isn't necessary to include it into your user.css file. Same as above, you can adjust everything to match your page; its quick and easy to do. Go ahead, copy the code below and give it a try on your own page.
<p style="float:right;
width:30%;
padding:8px;border:1px solid blue;
font-size:10;
margin-top:10px;margin-bottom:15px;
margin-left:10px;
background-color:#1E1E1E;">

<strong>Inline Pull Quotes</strong><br> 
You don't have to define the pullquotes in the style sheet. It's just another paragraph in CSS. 
</p> 
Go ahead have fun and most of all experiment. If you aren't sure of your CSS skills and could use a little help then be sure to check out the CSS tutorials online at W3Schools.com Need a bit more to help you out, then visit Newsgator and download either the trial version of Top Style or the Lite version for free.

Snow ....againGeek Stuff

Comments

avatar
This is good. :up:

By solid copper, # 9. March 2008, 06:18:16

avatar
Thanks, I'll be adding more and more like this.

By themugs, # 9. March 2008, 06:33:42

avatar
I will just visit here,, because then I can ask stupid questions :lol:

I know you :heart: that

By lesswoodsend, # 9. March 2008, 07:50:35

avatar
Only stupid question is the one unasked.

By themugs, # 9. March 2008, 07:54:57

avatar
Nice, especially the different stylings.

I've been using pullquotes in my blog aready, see I have a Mac, so I'm safe, right?, with yet another different styling.

One major difference though: instead of an anonymous div, or an ordinary paragraph, I'm using a blockquote element for the pullquotes. That's not only a semantically better markup (a pull quote is a quote after all, and that's what blockquote is for), but it will also be more accessible for those using screen reader software, precisely because it doesn't look an ordinary paragraph in the normal text flow.

I simply use a blockquote element with a class="pull" and have a style for that in my own stylesheet. That way you only have to define the style once and the styling will be consistent across different posts. My style also inherits the background "quote" image from My Opera's default style for blockquotes, but that can of course be overridden. All your styles can be applied to a blockquote element as well.

By JavaWoman, # 9. March 2008, 11:43:40

avatar
I haven't been using pullquotes. I think I may, on occasion. This is another one of those that is a great idea with potential for "too much of a good thing."

By noah counte, # 9. March 2008, 15:04:52

avatar
The div and paragraph style are used in these examples simply because they are simple. Not everyone has created their own CSS style sheets and this method allows them to do something different.

Accessibility on my blog is not an issue, my blog is not accessible at all. There are no ALT tags, no TITLE, LONG DESCRIPTION, nor ACRONYM tags in place, there are no alternative formats.

As for screen readers JAWS (the most common in use) can not read any page in the MyOpera community so that it makes sense.


<--------------------------------------------------------------------->

Quite right ...this has the potential to be grossly over used.

By themugs, # 9. March 2008, 17:53:16

avatar
Even if you don't use your own stylesheet, you can directly use your examples with blockquote instead of div or p, and it would have the same visual effect only be better markup. The stylesheet only comes in handy when you want a consistent style (and I do).

But I always pay attention to accessibility as well, not just semantics.

I cannot imagine JAWS cannot read any page here - it's highly configurable and can usually be made to read the most obstinate pages, and I don't see any obvious obstacles in the code (except possibly those created by user-created content). I joined here because of the clean and (almost) standards-compliant code! And that's the first step towards accessibility. That said, more could be done, and I'm working on a post related to that. :wink:

By JavaWoman, # 9. March 2008, 18:33:03

avatar
Cool post, nice trick, handy for ... well pullquotes or just a line in different format. :lol: :up:

By daxonmacs, # 29. June 2008, 08:13:12

Write a comment

You must be logged in to write a comment. if you're not a registered member, please sign up.

August 2008
MTWTFSS
July 2008September 2008
123
45678910
11121314151617
18192021222324
25262728293031