/    Sign up×
Community /Pin to ProfileBookmark

How do they do this?

I want to have my page look similier to this page, meaning everything is centered, and the space that isn’t not filled up with content is filled with a gradient on either side, and adjusts automatically for monitor size/resolution. I can’t figure out how to do it, if my code would be helpful I’ll post it and a link to my site, but just a general idea of how this is done would be nice. Right now my code is all wrapped in a container center it using CSS.

[URL=”http://www.motortopia.com/main/bikes”]http://www.motortopia.com/main/bikes[/URL]

And yes, my code is validated.

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@felgallJan 20.2007 — That page looks to be a mess with everything all over the place certainly not centered. I suppose they only bothered checking it in Internet Exploder and not in any modern web browsers.

  • 1. Make sure you have a doctype as the first tag in your page so as to put IE into standards mode where it at least tries to follow some of the standards.


  • To align text elements to the centre of the block that contains them use [b]text-align:center[/b]

    To align blocks to the centre you give them a width and set [b]margin:0 auto[/b]

    To set up a colour gradient you use a background image.
    Copy linkTweet thisAlerts:
    @blutterauthorJan 20.2007 — I think you misuderstood what I meant about the page I referanced. When I say everything is centered I mean the GRAY colored block is centered between the two black gradient side. And it works perfectly fine in both firefox and IE.
    Copy linkTweet thisAlerts:
    @CentauriJan 21.2007 — Apart from looking centred to me in FF, the points felgall raises apply to the page in question.

    Looking at the site's code will show the content in a div #wrapper. A look at the css shows [CODE]#wrapper{ border:1px solid transparent; border-bottom:none; border-top:none; margin:0 auto 1.33em auto; position:relative; width:947px}[/CODE] the div is set a width of 947px, and the auto margin does the centre.

    The "two black gradient side" is simply the background graphic applied to the body - graphic is here.

    Cheers

    Graeme
    ×

    Success!

    Help @blutter spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...