[thelist] CSS Question

Gerenday, Perry (P.) pgerenda at visteon.com
Wed Mar 6 17:20:00 CST 2002


-----Original Message-----
From: Burhan Khalid [mailto:burhankhalid at members.evolt.org]

 >...I've got the basic layout (three column, with
 > header on top)licked, but I'm having problem with
 > the background image in a CSS box.
 >
 > 	Here is my css :
 >
 > .smallbox {
 > 	border:1px solid black;
 > 	width:161px; overflow:hidden;
 > 	background:url("cal/snow.jpg") center;
 > 	float:none;
 >
 > 	}
 >
 > However, the picture will not center in an outlying box,
 > which contains it...

Hi Burhan,

You know the dimensions of both your parent box and the child. Presumably
these will not change. Is something like this too simple for what your
trying to achieve?

<div id="parent"
    style="position:absolute;
    top:200px; left:200px;
    width:190px; height:190px;
    border:2px solid #000000;">

    <div id="child"
        style="position:relative;
        margin:18px; /* set the margin for half the remaining inner space */
        width:150px; height:150px;
        background-color:#8855dd;
        border:2px solid #000000;">
   </div>
</div>

Is the background image larger than the child? Am I missing something
important?

HTH

Perry Gerenday
www.virtually-artistic.com
www.webinitiative.net




More information about the thelist mailing list