On Sun, Feb 24, 2008 at 12:19 AM, Hayden's Harness Attachment
<[EMAIL PROTECTED]> wrote:
>
>  Is it possible to control the width and height of a background URL using 
> CSS? I have a CSS file with "background: 
> URL(http://www.choroideremia.org/images/curve.gif) no-repeat 115px 0;".
>
>  Angus MacKinnon

Hello Angus,

If I understood you clearly, you mean controlling width and height of
a background image that is declared in CSS, not a URL's width and
height.

In that case you the simple answer is you can't. You can, however,
declare width and height dimensions in the same style rule that the
background image is being applied to. CSS allows you to control the
position of background images NOT their dimensions.

For example:

#header {
background: url(path/to/image.gif) no-repeat top left;
width: 100%;
height: 120px;
}

If image.gif is, say, 100px x 60px, then having height: 120px and
width: 100% allows the full image to be displayed. If you have had
something like:

#header {
background: url(path/to/image.gif) no-repeat top left;
width: 100%;
height: 40px;
}

then image.gif will be cut 20px from its bottom. If you declared your
CSS as follows:

#header {
background: url(path/to/image.gif) no-repeat bottom left;
width: 100%;
height: 40px;
}

your image will be cut 20px from its top.

So CSS background properties allow you to control the position of the image.

As a last note, the actual CSS for controlling background image
position is background-position.

Regards,
Usamah
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to