Jump to content

Centre Div


Dysan

Recommended Posts

Either use padding on the Basement itself. Or create a containing div, like this:

 

<style type="text/css">
#basement {
  width: 55em;
  min-height: 40em;
}
.CenterContentBox {
  padding: 1em;
}
</style>

 

It may be better to do something like:

<style type="text/css">
#basement {
  position: relative;
  width: 55em;
  min-height: 40em;
}
      /* Corner's on Basement */
.TopRightC {
  position: absolute;
  top: 0;
  right: 0;
  background: url("CornerImg1.jpg");
}
.TopLeftC {
  position: absolute;
  top: 0;
  left: 0;
  background: url("CornerImg1.jpg");
}
.BottomRightC {
  position: absolute;
  bottom: 0;
  right: 0;
  background: url("CornerImg1.jpg");
}
.BottomLeftC {
  position: absolute;
  bottom: 0;
  left: 0;
  background: url("CornerImg1.jpg");
}
.CenterContentBox {
  padding: 1em;      /* Using padding since FireFox doesn't render margin correctly */
}
</style>

 

Link to comment
Share on other sites

What would the HTML be for your CSS you posted?

 

 

Off-hand, The full code would be something like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="dk">

  <head>
<style type="text/css">
#basement {
  position: relative;
  width: 55em;
  min-height: 40em;
  border: 1px solid black; /* Border */
}
      /* Corner's on Basement */
.TopRightC {
  position: absolute;
  top: -1px;
  right: -1px;
  background: url("CornerImg1.jpg");
}
.TopLeftC {
  position: absolute;
  top: -1px;
  left: -1px;
  background: url("CornerImg1.jpg");
}
.BottomRightC {
  position: absolute;
  bottom: -1px;
  right: -1px;
  background: url("CornerImg1.jpg");
}
.BottomLeftC {
  position: absolute;
  bottom: -1px;
  left: -1px;
  background: url("CornerImg1.jpg");
}
      /* The Content Div'(s) */
.CenterContentBox {
  padding: 1em;      /* Using padding since FireFox doesn't render margin correctly */
}
</style>
  </head>

  <body>
    <div id="Basement">
      <div class="TopLeftC"></div>
      <div class="TopRightC"></div>
      <div class="BottomLeftC"></div>
      <div class="BottomRightC"></div>
      <div class="CenterContentBox">
      <p>This is the Content</p>
      </div>
    </div>
  </body>

</html>

 

 

 

 

 

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.