/    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

    2 Comments(s)

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

    <style type="text/css">
    body {
    #container {
    margin:0 auto;
    #contents {border:1px solid red;}

    <div id="container">
    <div id="contents">
    <p>centered contents</p>

  • 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:
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <link href="http://www.oursite.com/screen.css" rel="stylesheet" type="text/css" media="all">
    <!-- #include file="Header.html" -->
    <div align="center">
    <div id="Container">
    <!-- #include file="Footer.html" -->

  • 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.
  • ×


    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 11.30,
    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: @bahaedd,
    tipped: article
    amount: 1000 SATS,

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

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