Subscribe

Enter your email address:


Lastest posts


How to Embed Images as Background

Sponsored link

Blogger Template Design: Tutorial 12

If you look at these templates - Lasik, JournallRed, and Minimalizt - you'd notice that the background is not of a plain color, but made from a repeating pattern of an image. This image is called a background image. It can be a single large image that fills up the screen or a small image (say 50 x 50 pixels) that repeats horizontally and/or vertically. The neat thing about using, or embedding, a background image is that you can create any image you like and use it in your blog to make it unique and different from other blogs.

A background image can be placed in any container - either inside the Body container (which fills up the entire screen), inside the Post, Sidebar, Comment, or even on a header container (say, a Comment Header). For example, if you look at the Minimalizt template, you'll see that the Comment Header below the post is a rounded green button - which is an image embedded inside the Comment Header.

You can also use an image to create a shadowy-looking side frame (now quite common in blogs). See the Hazy template to see how it looks. To do this, you create a short background image with a long span that fills the whole width of the template. At the right and left edge of the background image, you create the shadowy pattern (or any other pattern that you want to be the frame), and embed this inside the outer-wrapper container, repeating it vertically.

But, how to embed and how to repeat the image vertically, horizontally, or both in directions?


To Embed Background Image:

Say that you want to use a 100 x 100 pixels image as the background image inside the Sidebar1 container. What you need to do is find the sidebar1 {...} container in CSS Styling and add the following code in red (the other codes are just sample codes):

#sidebar1 {
margin: 0px 10px 15px 10px;
padding: 0 0 0 0;
width: 150px;
background: URL(http://the-url-of-your-image) repeat left top;
text-align: left;
}


The "background:..." code will embed whatever image at whatever URL you put and repeat the pattern both vertically and horizontally. The location of the starting image will be on the left-most side, and at the top-most position. The general command for embedding a background image is:

background: URL(http://...) repeat-command x-position y-position;



All Repeat Command:
  • no-repeat (the image won't be repeated at all)
  • repeat (repeat horizontally and vertically)
  • repeat-x (only repeats horizontally)
  • repeat-y (only repeats vertically)
All Horizontal (x) Position Command:
  • left (puts the starting image on the left-most side)
  • center (puts the starting image at the center)
  • right (puts the starting image on the right-most side)
All Vertical (y) Position Command:
  • top (puts the starting image on the top-most position)
  • center (puts the starting image at the center)
  • bottom (puts the starting image on the bottom-most position)

Labels: ,




Translate to:

0 Comments:

Post a Comment

Thanks for your comment.

<< Home

Previous Posts

Cheap Hosting
-->