Jump To Content

LearnHub




CSS: Fluid images layout

A quick way of adding a header image to a fluid layout is it to break the header images into two slices and then assign the headers to a div in the same container like so.

<style type="text/css">
#myContainerName
{
background: url('/path/to/images/header-back.jpg') repeat-x;
height: 220px;
}

#myContainerName #leftBackground
{
background: url('/path/to/images/header-left.jpg') left no-repeat;
height: 100%;
width: 100%;
}

#myContainerName #rightBg
{
background: url('./path/to/images/header-right.jpg') right no-repeat;
height: 100%;
width: 100%;
}
</style>

And the HTML will look like so ...

<div id="myContainerName">
<div id="rightBg">
<div id="leftBg">
<!-- Content Here -->
</div>
</div>
</div>


  1. kaitomono saidThu, 12 Jun 2008 15:19:21 -0000 ( Link )

    Thanks! I am wondering is there a way to easily take a static width page and turn it into a fluid page? Is it just the width that you need to worry about or is the whole of the css influenced?

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  2. laurellion saidThu, 12 Jun 2008 15:22:44 -0000 ( Link )

    A quick and dirty way is to change the dimensions in the CSS file from either pixels or em to % for the width. For the length, your file would normally be fine unless your CSS file has a limit on the length of the columns.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  3. kaitomono saidThu, 12 Jun 2008 19:46:06 -0000 ( Link )

    Well that sounds simple enough, I’ll give that try and see how the fonts etc work out with it. Should be good! :)

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

Your Comment
Textile is Enabled (View Reference)