Jump to content

Can a background image overflow its container?


wright67uk

Recommended Posts

Can a background image overflow its container?

 

#banner
{
height:54px;
width:100%;
background-color:#36F;
background-image:url(i-stevenage.png);
background-repeat:no-repeat;
background-position:5% 0%;
}

 

is it possible to have a background image spill over the top and bottom of #banner?

somthing like;

 

background-image:overflow; ???

Link to comment
Share on other sites

Can a background image overflow its container?

Nope strictly spoken it can't. But, the padding property, might be what you're looking for. (btw  have a look at the css boxmodel)

if you give a container a padding of say 50px

div#container{
  padding:25px; /* shorthand for 25px at each side  makes it both horizontally and vertically +50px*/
}

the content of that container will not touch the border, but have some space around it. That way you can make the background appear to "overflow". (got a small article on my blog if interested, but there are quite some out there).

 

Hope this helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.