How to set background image margin in css?
Background images, just as the name implies, are part of the BACKGROUND of a website, not part of the actual content. The most common place to add a background image to, is the entire canvas – aka the body tag.
The CSS to add an image to a body tag is simple:
body { background: url(bgimage.jpg); }
« Deleting Browser Default Settings in CSS
Styling different links differently with CSS »
How to Add a Background Image with CSS
Background images, just as the name implies, are part of the BACKGROUND of a website, not part of the actual content. The most common place to add a background image to, is the entire canvas – aka the body tag.
The CSS to add an image to a body tag is simple:
body
{
background: url(bgimage.jpg);
}
I’m just using a random image for demonstration purposes, and THIS this is what we get. And we can note the following:
There are also special background images that are designed to tile unnoticeable -for example this one:
The CSS to add an image to a body tag is simple:
body { background: url(bgimage.jpg); }
« Deleting Browser Default Settings in CSS
Styling different links differently with CSS »
How to Add a Background Image with CSS
Background images, just as the name implies, are part of the BACKGROUND of a website, not part of the actual content. The most common place to add a background image to, is the entire canvas – aka the body tag.
The CSS to add an image to a body tag is simple:
body
{
background: url(bgimage.jpg);
}
I’m just using a random image for demonstration purposes, and THIS this is what we get. And we can note the following:
- It’s a very beautiful flower (grew in my house)
- It repeats itself and covers the entire background – that is called ’tiling’ (think bathroom)
- It pretty much makes it impossible to read the actual page content
There are also special background images that are designed to tile unnoticeable -for example this one:
CSS also gives us the tools to direct our background image how we want it. The default, as you can see, is that it repeats itself horizontally AND vertically to fill the entire background, regardless of size. Sometimes we might want the image appear only horizontally or vertically – and maybe not directly on the edge of the viewing area.
body { background: url(bgimage.jpg) repeat-x bottom; }
body { background: url(bgimage.jpg) no-repeat #f6f1b9 fixed top right; padding-right: 250px; }
Article Source: csstutorial.net
body {
background: url(bgimage.jpg);
}
body {
background: url(bgimage.jpg);
}
body {
background: url(bgimage.jpg);
}
body {
background: url(bgimage.jpg);
}body { background: url(bgimage.jpg); }
0 comments:
Post a Comment