/    Sign up×
Community /Pin to ProfileBookmark

DIV Height, Width, and Centering

I’ve got two problems that I can’t seem to figure out.

  • 1.

    I have a div that contains all of the elements on a page and is set to be centered on a page. It’s works fine in all browsers except IE for the MAC.

  • 2.

    I have another div that has a background image and it’s width and height are set to the size of that image. However it only shows the image in IE for PC.

  • Any ideas on these two issues? Thanks!

    to post a comment
    CSS

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @FangAug 12.2005 — 
  • 1. Does it look like this:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>center contents</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <style type="text/css">
    <!--
    body {
    text-align:center;
    }
    #container {
    margin:0 auto;
    width:600px;
    text-align:left;
    }
    #contents {border:1px solid red;}
    -->
    </style>

    </head>
    <body>
    <div id="container">
    <div id="contents">
    <p>centered contents</p>
    </div>
    </div>
    </body>
    </html>


  • 2. Have you set the background image position to [I]top left[/I]
  • Copy linkTweet thisAlerts:
    @nbcrockettauthorAug 12.2005 — 
  • 1. Here's what the code looks like.

    HTML Code:
    [CODE]<html>
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title></title>
    <link href="http://www.oursite.com/screen.css" rel="stylesheet" type="text/css" media="all">
    </head>
    <body>
    <!-- #include file="Header.html" -->
    <div align="center">
    <div id="Container">
    </div>
    </div>
    <!-- #include file="Footer.html" -->
    </body>
    </html>[/CODE]


  • CSS Code:
    [CODE]#Container {
    text-align: left;
    margin-top: 40px;
    margin-bottom: 40px;
    z-index: -1;
    width: 760px }[/CODE]


  • 2. The image is set to top left.
  • ×

    Success!

    Help @nbcrockett 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 4.27,
    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: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

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

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...