# HTML Sidebar Background

**URL:** <https://boards.straightdope.com/t/html-sidebar-background/204529>\
**Category:** Factual Questions\
**Created:** [September 29, 2003, 7:01pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529 "2003-09-29T19:01:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duderdude2](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@Duderdude2](https://boards.straightdope.com/u/Duderdude2)\
**Post date:** [September 29, 2003, 7:01pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529/1 "2003-09-29T19:01:55Z")

</div>

How can I place a background behind the sidebar? For instance, on the left side of my page, I have various links, however, behind them I’d like to have a background. I hope that makes sense.

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [September 29, 2003, 7:10pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529/2 "2003-09-29T19:10:34Z")

</div>

There’s lots of ways. you can have a background image with a DIV like this:

> [@](#):
>
> \<div style=“background-image: url(image.gif)”\>  
> Your buttons  
> \</div\>

you can make a background image for a table. Like this:

> [@](#):
>
> \<table background=image.gif\>  
> \<tr\>\<td\>  
> YOUR BUTTONS  
> \</td\>\</tr\>  
> \</table\>

You can make a big table for your site and just give a background to the cell with the buttons in it:

> [@](#):
>
> \<table width=100%\>  
> \<tr\>\<td width=10% background=image.gif\>  
> YOUR BUTTONS  
> \</td\>\<td\>  
> THE REST OF YOUR PAGE  
> \</td\>\</tr\>  
> \</table\>

Of course you gotta make nicer, fuller code and check across all browsers. Last time I checked the NS4 series it had wacky cell background image handling.

Oh and if you just want solid color backgrounds, the code for tables is bgcolor=####### and for style tags it’s style=“background-color:#######”

That help?

---

<div class="post-metadata">

**Author:** ![Duderdude2](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@Duderdude2](https://boards.straightdope.com/u/Duderdude2)\
**Post date:** [September 29, 2003, 8:11pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529/3 "2003-09-29T20:11:41Z")

</div>

That was outstanding, many thanks. I did know that at one time, but it’s been years since I’ve dealt with HTML. Anyways, many thanks.

---

<div class="post-metadata">

**Author:** ![Duderdude2](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@Duderdude2](https://boards.straightdope.com/u/Duderdude2)\
**Post date:** [September 29, 2003, 9:01pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529/4 "2003-09-29T21:01:51Z")

</div>

Oh, one more question. Is there a way to push a table all the way to the left side of the page, so there’s no gap?

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [September 29, 2003, 9:07pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529/5 "2003-09-29T21:07:16Z")

</div>

Yeah, if you’ve got the table set at width=100% then you can also do this to your body tag:

> [@](#):
>
> \<body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0 marginheight=0 marginwidth=0\>

Add all that stuff to your existing body tag, btw. Don’t just add another body tag 🙂

---

<div class="post-metadata">

**Author:** ![Duderdude2](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@Duderdude2](https://boards.straightdope.com/u/Duderdude2)\
**Post date:** [September 29, 2003, 9:32pm UTC](https://boards.straightdope.com/t/html-sidebar-background/204529/6 "2003-09-29T21:32:44Z")

</div>

Thanks Zipper, you’ve been a huge help.
