Jump to content

[SOLVED] background image height


isaac_cm

Recommended Posts

ok, but is there a way to align background correctly behind my nav buttons on the left in resolution 800x600 the nav bar is on the left of the screen but in resolution 1024x768 the nav bar centered along with the content box but the background is not

 

I used the following css:

 

body {

background-image: url(../images/page_bottom.jpg);

background-position: left;

background-repeat: repeat-y;

}

 

also attached an image of the problem

 

[attachment deleted by admin]

Link to comment
Share on other sites

for reference only there is a way to make the background running to the screen bottom it is like using cheat codes in games :)

 

One of the disadvantages of CSS is its inability to be controlled vertically, causing one particular problem which a table layout doesn't suffer from. Say you have a column running down the left side of the page, which contains site navigation. The page has a white background, but you want this left column to have a blue background. Simple, you assign it the appropriate CSS rule:

 

#navigation

{

background: blue;

width: 150px

}

 

Just one problem though: Because the navigation items don't continue all the way to the bottom of the screen, neither does the background colour. The blue background colour is being cut off half way down the page, ruining your great design. What can you do!?

 

Unfortunately one of the only solutions to this is to cheat, and assign the body a background image of exactly the same colour and width as the left column. You would use this CSS command:

 

body

{

background: url(blue-image.gif) 0 0 repeat-y

}

 

This image that you place in the background should be exactly 150px wide and the same blue colour as the background of the left column. The disadvantage of using this method is that you can't express the left column in terms of em, as if the user resizes text and the column expands, it's background colour won't.

 

Using this method the left column will have to be expressed in px if you want it to have a different background colour to the rest of the page.

by Trenton Moss

Link to comment
Share on other sites

What you are asking for is an advanced css technique that requires some understanding of how the background of an block/box works.

 

Moberemk gave you an advanced solution. But he can't just give it to you, without you understanding what it is he proposed.

 

But he (we) is guessing as to what it is you are actually asking. Can you show a sample?

 

You already showed a solution. Use repeats.

 

Try to "tile" the image without limitation:

 

background-repeat: repeat;

 

The above will repeat it both width and height for the full size of the column (whatever size it is).

 

 

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.