Web Design

Magic of CSS border property

CSS have great command over its border property. We are still using images for things like triangle and some other shapes. But from now it’s not needed. We can developer same shapes with CSS also. Here are some tricks to replace the images with css. Lets do it now.

For live demo check this link : CSS Shapes Demo

Up side Triangle:

Up Side Triangle

[cc lang=”css”]
.triangle_up
{
height:0px; width:0px;
border-bottom:50px solid #006633;
border-left:50px solid transparent;
border-right:50px solid transparent;
}
[/cc]

Down side Triangle:

Bottom Side Triangle

[cc lang=”css”]
.triangle_down
{
height:0px; width:0px;
border-top:50px solid #006633;
border-left:50px solid transparent;
border-right:50px solid transparent;
}
[/cc]

Left side Triangle:

Left Side Triangle

[cc lang=”css”]
.triangle_left
{
height:0px; width:0px;
border-left:50px solid #006633;
border-top:50px solid transparent;
border-bottom:50px solid transparent;
float:left;
}
[/cc]

Right side Triangle:

Right Side Triangle

[cc lang=”css”]
.triangle_right
{
height:0px; width:0px; float:left;
border-right:50px solid #006633;
border-top:50px solid transparent;
border-bottom:50px solid transparent;
}
[/cc]

Cross Square:

CSS Cross Square

[cc lang=”css”]
.crossSquare
{
height:0px; width:0px;
border-right:50px solid blue;
border-top:50px solid gray;
border-bottom:50px solid red;
border-left:50px solid yellow;
}
[/cc]

Direction Arrow:

Direction Arraow

Below CSS should be used with given HTML code:

[cc lang=”css”]
.arrowLine
{
background-color:#006633;
border-bottom:0 solid transparent;
border-top:0 solid transparent;
height:100px;
width:50px;
float:left;
}

.triangle_left
{
height:0px; width:0px;
border-left:50px solid #006633;
border-top:50px solid transparent;
border-bottom:50px solid transparent;
float:left;
}

.triangle_right
{
height:0px; width:0px; float:left;
border-right:50px solid #006633;
border-top:50px solid transparent;
border-bottom:50px solid transparent;
}
[/cc]

HTML Code:

[cc lang=”html”]

[/cc]

And finally Delicious Logo:

Delicious Logo

CSS Code:

[cc lang=”css”]
.delociousLogo
{
height:100px; width:100px;
}

.topleft
{
height:0px; width:0px;
border-top:50px solid #FFFFFF;
border-right:0px solid #FFFFFF;
border-bottom:0px solid #FFFFFF;
border-left:50px solid #FFFFFF;
float:left;
}

.topright
{
float:left;
height:0px; width:0px;
border-top:50px solid #0000CC;
border-right:0px solid #0000CC;
border-bottom:0px solid #0000CC;
border-left:50px solid #0000CC;
}

.bottomleft
{
float:left;
height:0px; width:0px;
border-top:50px solid #000000;
border-right:0px solid #000000;
border-bottom:0px solid #000000;
border-left:50px solid #000000;
}

.bottomright
{
float:left;
height:0px; width:0px;
border-top:50px solid #999999;
border-right:0px solid #999999;
border-bottom:0px solid #999999;
border-left:50px solid #999999;
}
[/cc]

HTML Code:

[cc lang=”html”]

[/cc]

For live demo check this link ” CSS Shapes Demo

Hope you like this. Waiting for your responses.

Shares:
  • evnisha
    evnisha
    September 6, 2010 at 4:44 pm

    wow !
    great i really like this.

    Reply
  • Pogue
    Pogue
    September 26, 2010 at 6:09 am

    Man, talk about a great post! I’ve stumbled across your blog a few times inside the past, but I usually forgot to save it. But not again! Thanks for writing the way you do, I truly enjoy seeing somebody who actually has an opinion and is not just regurgitating crap like most other writers today. Keep it up!

    Reply
  • TrepUrbaksTek
    TrepUrbaksTek
    July 20, 2011 at 1:18 am

    nice, very nice.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *