css and corner image on a div

  • Thread starter Philippe Rousselot
  • Start date
P

Philippe Rousselot

Hi,

is there a way to assign an image to each upper corner of a div using css

kind of
..roundtop {
background: url( ) no-repeat top right;
background: url( ) no-repeat top left ;
}
but something that works ...


Thanks

Philippe
 
S

Steve Pugh

Philippe Rousselot said:
is there a way to assign an image to each upper corner of a div using css

kind of
.roundtop {
background: url( ) no-repeat top right;
background: url( ) no-repeat top left ;
}
but something that works ...

Not yet. It has been suggested and may end up being included in a
standard and/or implemented sometime in teh next decade.
See http://ln.hixie.ch/?start=1098915335&order=-1&count=5

At the moment you'll need to introduce some redundent elements in
order to place the additional background(s).

Steve
 
N

Nik Coughin

Philippe said:
Hi,

is there a way to assign an image to each upper corner of a div using
css

kind of
.roundtop {
background: url( ) no-repeat top right;
background: url( ) no-repeat top left ;
}
but something that works ...


Thanks

Philippe

Hi Philippe,

You just have to wrap blocks inside other blocks in order to do this,
instead of trying to assign all of the background elements to the same
block.

Think about a compass:

NW N NE

W E

SW S SW

Assume that you use this system to label each of your corners, and also
assume for the moment that you are using corners that are 24x24px, you can
do something like this:

..bodyNW
{
background: url( bodyNW.png ) no-repeat top left;
}

..bodyN
{
background: url( bodyN.png ) repeat-x top;
margin-left: 24px;
margin-right: 24px;
}

..bodyNE
{
background: url( bodyNE.png ) no-repeat top right;
}

..bodyW
{
background: url( bodyW.png ) repeat-y left;
}

..body
{
background: url( body.png );
margin-left: 24px;
margin-right: 24px;
}

..bodyE
{
background: url( bodyE.png ) repeat-y right;
}

..bodySW
{
background: url( bodySW.png ) no-repeat bottom left;
}

..bodyS
{
background: url( bodyS.png ) repeat-x bottom;
margin-left: 24px;
margin-right: 24px;
}

..bodySE
{
background: url( bodySE.png ) no-repeat bottom right;
}

..bodyN img
{
height: 24px;
}

..bodyS img
{
height: 24px;
}

..bodyNW, .bodyNE, .bodyN, .bodySW, .bodySE, .bodyS
{
font-size: 0;
lineheight: 0;
}


<div class="bodyNW">
<div class="bodyNE">
<div class="bodyN">
<img src="spacer.png" alt="">
</div>
</div>
</div>
<div class="bodyW">
<div class="bodyE">
<div class="body">

Content.

</div>
</div>
</div>
<div class="bodySW">
<div class="bodySE">
<div class="bodyS">
<img src="spacer.png" alt="">
</div>
</div>
</div>

If you would like to see this in use, here is a site I am working on at the
moment:
http://www.nrkn.com/masterpiece/
 
T

Travis Newbury

Steve said:
Not yet. It has been suggested and may end up being included in a
standard and/or implemented sometime in teh next decade.

Which sadly means it will not be supported by Microsoft until 2022...
 
T

Travis Newbury

Philippe said:
is there a way to assign an image to each upper corner of a div using css

What are you trying to do? Use images for the corners? if so, google
rounded corners CSS and be rewarded with a ton of examples.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top