coder
coder

Reputation: 6233

How do you set up a custom body tag

I want to create a site with a background one color and the centered content section another color. I am having trouble setting up custom tags to achieve this. Here's what I have:

A custom body tag -

<body style="background-color: #000000" >
<div  style="text-align:right; padding: 10px; background-color:white; width:800px">
 <jsp:doBody />
</div>
<n:footer></n:footer>
</body>

It seems to me that anything that I include between the custom body tags on my jsp should have the background-color = white and everything else around it should be color = #000000. This isn't the case. Instead I only have a band 10px high across the page. What am I doing wrong?

Upvotes: 0

Views: 304

Answers (2)

kyerie
kyerie

Reputation: 106

usually I just do this:

<body style="padding:0;margin:0;background-color:#000;">
    <div style="margin:0 auto;width:800px;background-color:#fff;">This is the content</div>
</body>

since div has margin:auto for its left and right margins, it will automatically center itself. Just make sure to add a width property, else it won't work.

Upvotes: 0

Blender
Blender

Reputation: 298432

The <div> collapses if there is no content. Give it some text.

Upvotes: 1

Related Questions