CSS Unleashed - Experiments with Background Images and Backgrounds
The background element in CSS offers a wide range of possibilities including embedded background images, content over backgrounds, and backgrounds as art. As you play with your CSS experiments with backgrounds and background images, it's important to understand how they work, where they work, and how to control their appearance. Let's start with a few CSS experiments in placement.
For more information on how these were done and how to use these CSS design elements and style experiments, see CSS Experiments - How They Were Done and More and CSS Experiments Putting It All Together.
To see how these CSS experimental boxes and styles work, view the source code of the page. In your web browser menu, click VIEW > SOURCE or VIEW > PAGE SOURCE to view the source code. For the most part, the styles are included inline with each design.
- CSS Unleashed - Experiments with CSS Designs
- CSS Book Recommendations
- CSS Experiments Playing With CSS Blocks
- CSS Experiments with CSS Logo Designs
- CSS Experiments with Background Images and Backgrounds
- CSS Experiments with Lists, Menus, Tables of Content, and More
- CSS Experiments - Web Fonts and Embedded Fonts
- CSS Unleashed - Experiments with Quotations, Pull-quotes and Blockquotes
- CSS Unleashed - Experiments Showcasing Your Photography
- CSS Experiments - Variations on a Theme
- CSS Experiments - How They Were Done and More
- CSS Experiments Putting It All Together
We've looked at how our CSS experiments have dealt with the positioning of background images. Now, let's look at the effects of a repeating graphic and some interesting CSS experiments that can be done.
In the first example CSS experiment with repeating backgrounds, we have a two tone graphic
with a green and red block. We've set the graphic to repeat in all directions through our CSS styles. Because the graphic is repeated evenly across and down, the effect becomes stripes.
When working with repeating graphics within their own division, using the non-repeating space (spacebar or , the container for the background image takes on the characteristics of what the space would normally look like in a sentence, reflecting the font-size, leading and kerning. Instead of using
<div style="background:url(something.gif) repeat"> </div>
you would use comments in place of the "space" such as
<div style="background: url(something.gif) repeat"> <!--comment --></div>
This eliminates the leading and kerning restrictions and the container would then reflect only the sizes set by the height and width such as
<div style=" height:50px; width:10px; background: url(something.gif) repeat"><!--comment --></div>.
Let's see what we can do with these CSS experiments in repeating backgrounds.
Ah, we've opened up the imagination with our CSS experiments. Now we can do a variety of things using the background images as lines and bars of infinite width and height. This can lead to interesting graphic designs and even the formidable bar charts for measuring the many numbers found in research and business. You can find more information on layout out pure CSS charts at Web Page Design for Designers: Drawing with CSS (towards bottom of the page).
George Eliot
Ralph Crawshaw
Source: Travel Industry Association
4.1 Million
4.1 Million
4.0 Million
2.0 Million
1.4 Million
901,000
Source: Travel Industry Association
4.1 Million
4.1 Million
4.0 Million
2.0 Million
1.4 Million
901,000
Using the above CSS experiment techniques, we can create other interesting effects with background images. Ever wanted a background that had a fading effect? A large background image, even one with a gradient fade, can have a large file size. Optimizing and streamling your web page design code and design size is critical to a fast loading web page. Instead of using a large background image, you can use a small image and set it to repeat.
In the next two CSS experiments examples, we've used two narrow graphics exactly the same. One is horizontal and the other is veritcal. They have a measurement of 4px by 200px and each have a file size of about 1300 bytes.
Peter Stevens, Patterns in Nature
Ovid
Well, I hope it does.
Authors, photographers, teachers, and public speakers, Lorelle and Brent VanFossen, travel extensively with their camera and pen in hand to bring you a variety of articles on nature and travel photography including basic nature photography and the photography business, writing, travel, recreational vehicles, web page design, and life on the road. All images, design, and content are copyrighted and protected by law.
You can find related articles to this topic in our Web Pages and CSS Tips and Tricks and Photographycategories. The previous post is CSS Unleashed - Experiments with Lists, Menus, Tables of Content, and More and the next post is CSS Unleashed - Experiments Showcasing Your Photography. CSS Unleashed - Experiments with Background Images and Backgrounds, Issue Number 159, by Lorelle VanFossen, was updated September 2nd, 2006.
You can follow comments through the RSS 2.0 feed and you can find more feeds on our Feeds List. Your comment is welcome, as are trackbacks from your site.
Article Series - CSS Experiments
- CSS Unleashed - Experiments with CSS Designs
- CSS Unleashed - Variations on a Theme
- CSS Unleashed - Experiments Playing With CSS Blocks
- CSS Unleashed - Experiments with Background Images and Backgrounds
- CSS Unleashed - Experiments with Lists, Menus, Tables of Content, and More
- CSS Unleashed - Experiments with Quotations, Pull-quotes and Blockquotes
- CSS Unleashed - Experiments Showcasing Your Photography
- CSS Unleashed - Experiments with CSS Logo Designs
- CSS Unleashed - Experiments Putting It All Together
- CSS Experiments - How They Were Done and More
Next: CSS Unleashed - Experiments with Lists, Menus, Tables of Content, and More
Previous: CSS Unleashed - Experiments Playing With CSS Blocks
Related Articles
- CSS Unleashed - Experiments with CSS Logo Designs
- CSS Unleashed - Experiments Playing With CSS Blocks
- CSS Unleashed - Variations on a Theme
- CSS Tips and Tricks
- CSS Tips and Tricks - CSS Links and Rollovers
- CSS Experiments - How They Were Done and More
- CSS Experiments - Web Fonts and Embedded Fonts
- CSS Unleashed - Experiments with Lists, Menus, Tables of Content, and More
Submit Article: BlinkList | Blogmarks | Digg | Del.icio.us | Ekstreme Socializer | Feedmarker | Furl | Google Bookmarks | ma.gnolia | Netvouz | RawSugar | Reddit | Scuttle | Shadows | Simpy | Spurl | Technorati | Unalog | Wink | Yahoo MyWeb2


September 7, 2006
Most wonderful tips & ideas. Thank you!!