You are here: Decorating div boxes with CSS « HTML « IT news, forums, messages
Decorating div boxes with CSS

Posted by Paul B on 04/12/06 20:03

I hope at least some of this makes sense...

Here is my CSS:
.tl{
position:absolute;
left:0px;
right:auto;
top:0px;
bottom:auto;
width:15px;
height:15px;
background-image:url('tl.png');
}
.t{
position:absolute;
left:15px;
right:15px;
top:0px;
bottom:auto;
width:auto;
height:15px;
background-image:url('t.png');
}
.tr{
position:absolute;
left:auto;
right:0px;
top:0px;
bottom:auto;
width:15px;
height:15px;
background-image:url('tr.png');
}
.l{
position:absolute;
left:0px;
right:auto;
top:15px;
bottom:15px;
width:15px;
height:auto;
background-image:url('l.png');
}
.c{
position:absolute;
left:15px;
right:15px;
top:15px;
bottom:15px;
width:auto;
height:auto;
background-color:black;
color:yellow;
}
.r{
position:absolute;
left:auto;
right:0px;
top:15px;
bottom:15px;
width:15px;
height:auto;
background-image:url('r.png');
}
.bl{
position:absolute;
left:0px;
right:auto;
top:auto;
bottom:0px;
width:15px;
height:15px;
background-image:url('bl.png');
}
.b{
position:absolute;
left:15px;
right:15px;
top:auto;
bottom:0px;
width:auto;
height:15px;
background-image:url('b.png');
}
.br{
position:absolute;
left:auto;
right:0px;
top:auto;
bottom:0px;
width:15px;
height:15px;
background-image:url('br.png');
}

#box1{
position:absolute;
left:0px;
right:auto;
top:0px;
bottom:auto;
width:250px;
height:250px;
}
The point of it is that a 'content box' will have 4 'empty' divs before
it and 4 after it. The block of text in the centre will then be
surrounded by 8 images. In my case its a kind of fading black into
white effect. And here is the HTML:
<div id="box1">
<div class="tl">
</div>
<div class="t">
</div>
<div class="tr">
</div>
<div class="l">
</div>
<div class="c">
Lots of text lots of text lots of text lots of text lots of
text lots of text lots of text
</div>
<div class="r">
</div>
<div class="bl">
</div>
<div class="b">
</div>
<div class="br">
</div>
</div>

And (in my opinion) it looks really good... but it only works if I know
what size to make the box. If there is too much text in the centre bit
it flows off out the bottom and looks stupid. But as the edge bits are
stuck in place using absolute positioning it only works if the box they
are in are positioned absolutely. So i'm wondering if there is a way to
create a similar effect but without absolute positioning?

Any ideas?

Paul

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация