![]() |
|
|
|
||||||||||
![]() |
|
|
Thread Tools |
|
#1
|
||||
|
||||
|
Some different shapes without using image controlling with CSS
Hi ALL!
kindly take a look of the following code hope it will help you all <style type="text/css"> body {font-family:Arial, Helvetica, sans-serif, Tahoma; font-size:11px;} #info {display:block; position:relative; background:#adced1;} #info h2 {margin-bottom:1em;} #info h3 {clear:both; margin-top:4em;} /* Inset 3D Raised */ .raised { background: transparent; width:40%; margin:0 auto; } .raised h1, .raised p {margin:0 10px;} .raised h1 {font-size:2em; color:#fff; letter-spacing:1px;} .raised p {padding-bottom:0.5em;} .raised .top, .raised .bottom {display:block; background:transparent; font-size:1px;} .raised .b1, .raised .b2, .raised .b3, .raised .b4, .raised .b1b, .raised .b2b, .raised .b3b, .raised .b4b {display:block; overflow:hidden;} .raised .b1, .raised .b2, .raised .b3, .raised .b1b, .raised .b2b, .raised .b3b {height:1px;} .raised .b2 {background:#ccc; border-left:1px solid #fff; border-right:1px solid #eee;} .raised .b3 {background:#ccc; border-left:1px solid #fff; border-right:1px solid #ddd;} .raised .b4 {background:#ccc; border-left:1px solid #fff; border-right:1px solid #aaa;} .raised .b4b {background:#ccc; border-left:1px solid #eee; border-right:1px solid #999;} .raised .b3b {background:#ccc; border-left:1px solid #ddd; border-right:1px solid #999;} .raised .b2b {background:#ccc; border-left:1px solid #aaa; border-right:1px solid #999;} .raised .b1 {margin:0 5px; background:#fff;} .raised .b2, .raised .b2b {margin:0 3px; border-width:0 2px;} .raised .b3, .raised .b3b {margin:0 2px;} .raised .b4, .raised .b4b {height:2px; margin:0 1px;} .raised .b1b {margin:0 5px; background:#999;} .raised .boxcontent {display:block; background:#ccc; border-left:1px solid #fff; border-right:1px solid #999;} /* Inset 3D Curved */ .inset {background: transparent; width:40%; margin:0 auto;} .inset h1, .inset p {margin:0 10px;} .inset h1 {font-size:2em; color:#fff; letter-spacing:1px;} .inset p {padding-bottom:0.5em;} .inset .top, .inset .bottom {display:block; background:transparent; font-size:1px;} .inset .b1, .inset .b2, .inset .b3, .inset .b4, .inset .b1b, .inset .b2b, .inset .b3b, .inset .b4b {display:block; overflow:hidden;} .inset .b1, .inset .b2, .inset .b3, .inset .b1b, .inset .b2b, .inset .b3b {height:1px;} .inset .b2 {background:#ccc; border-left:1px solid #999; border-right:1px solid #aaa;} .inset .b3 {background:#ccc; border-left:1px solid #999; border-right:1px solid #ddd;} .inset .b4 {background:#ccc; border-left:1px solid #999; border-right:1px solid #eee;} .inset .b4b {background:#ccc; border-left:1px solid #aaa; border-right:1px solid #fff;} .inset .b3b {background:#ccc; border-left:1px solid #ddd; border-right:1px solid #fff;} .inset .b2b {background:#ccc; border-left:1px solid #eee; border-right:1px solid #fff;} .inset .b1 {margin:0 5px; background:#999;} .inset .b2, .inset .b2b {margin:0 3px; border-width:0 2px;} .inset .b3, .inset .b3b {margin:0 2px;} .inset .b4, .inset .b4b {height:2px; margin:0 1px;} .inset .b1b {margin:0 5px; background:#fff;} .inset .boxcontent {display:block; background:#ccc; border-left:1px solid #999; border-right:1px solid #fff;} /* Chamfer Borders*/ .chamfer {background: transparent; width:40%; margin:0 auto;} .chamfer h1, .chamfer p {margin:0 10px;} .chamfer h1 {font-size:2em; color:#000; letter-spacing:1px;} .chamfer p {padding-bottom:0.5em;} .chamfer .top, .chamfer .bottom {display:block; background:transparent; font-size:1px;} .chamfer .b1, .chamfer .b2, .chamfer .b3, .chamfer .b4, .chamfer .b5 {display:block; overflow:hidden; height:1px; background:#eca; border-left:1px solid #000; border-right:1px solid #000;} .chamfer .b1 {margin:0 5px; background:#000;} .chamfer .b2 {margin:0 4px;} .chamfer .b3 {margin:0 3px;} .chamfer .b4 {margin:0 2px;} .chamfer .b5 {margin:0 1px;} .chamfer .boxcontent {display:block; background:#eca; border-left:1px solid #000; border-right:1px solid #000;} /* Square cutout Borders*/ .square {background: transparent; width:40%; margin:0 auto;} .square h1, .square p {margin:0 10px;} .square h1 {font-size:2em; color:#00c; letter-spacing:1px;} .square p {padding-bottom:0.5em;} .square .top, .square .bottom {display:block; background:transparent; font-size:1px;} .square .b1t {margin:0 6px; display:block; overflow:hidden; height:5px; background:#9ce; border-left:1px solid #00c; border-right:1px solid #00c; border-top:1px solid #00c;} .square .b2 {display:block; height:1px; margin:0; background:#9ce; border-left:7px solid #00c; border-right:7px solid #00c; overflow:hidden;} .square .b1b {margin:0 6px; display:block; overflow:hidden; height:5px; background:#9ce; border-left:1px solid #00c; border-right:1px solid #00c; border-bottom:1px solid #00c;} .square .boxcontent {display:block; background:#9ce; border-left:1px solid #00c; border-right:1px solid #00c;} /* Curved cutout Borders*/ .curved {background: transparent; width:40%; margin:0 auto;} .curved h1, .curved p {margin:0 10px;} .curved h1 {font-size:2em; color:#fff; letter-spacing:1px;} .curved p {padding-bottom:0.5em;} .curved .top, .curved .bottom {display:block; background:transparent; font-size:1px;} .curved .b1, .curved .b2, .curved .b3, .curved .b4 {display:block; overflow:hidden; height:1px;} .curved .b2, .curved .b3, .curved .b4 {background:#e0cea3; border-left:1px solid #fff; border-right:1px solid #fff;} .curved .b1 {margin:0 4px; background:#fff;} .curved .b2 {margin:0 4px; height:2px;} .curved .b3 {margin:0 3px;} .curved .b4 {margin:0; height:1px; border-width:0 3px 0 3px;} .curved .boxcontent {display:block; background:#e0cea3; border:0 solid #fff; border-width:0 1px;} /* flared serif */ .serif {background: transparent; width:40%; margin:0 auto;} .serif h1, .serif p {margin:0 10px;} .serif h1 {font-size:2em; color:#fff; letter-spacing:1px;} .serif p {padding-bottom:0.5em;} .serif .top, .serif .bottom {display:block; background:transparent; font-size:1px;} .serif .b1, .serif .b2, .serif .b3, .serif .b4 {display:block; overflow:hidden;} .serif .b1, .serif .b2, .serif .b3 {height:1px;} .serif .b2, .serif .b3 {background:#fc0; border-left:1px solid #fff; border-right:1px solid #fff;} .serif .b4 {background:#fc0; border-left:1px solid #fff; border-right:1px solid #fff;} .serif .b1 {margin:0; background:#fff;} .serif .b2 {margin:0 1px; border-width:0 2px;} .serif .b3 {margin:0 3px;} .serif .b4 {height:2px; margin:0 4px;} .serif .boxcontent {display:block; background:#fc0; border-left:1px solid #fff; border-right:1px solid #fff; margin:0 5px;} /* Pillar type */ .pillar {background: transparent; width:40%; margin:0 auto;} .pillar h1, .pillar p {margin:0 10px;} .pillar h1 {font-size:2em; color:#fff; letter-spacing:1px;} .pillar p {padding-bottom:0.5em;} .pillar .top, .pillar .bottom {display:block; background:transparent; font-size:1px;} .pillar .b1, .pillar .b2, .pillar .b3, .pillar .b4 {display:block; overflow:hidden;} .pillar .b1, .pillar .b2, .pillar .b4 {height:1px;} .pillar .b2, .pillar .b3 {background:#d66; border-left:1px solid #fff; border-right:1px solid #fff;} .pillar .b4 {background:#d66; border-left:4px solid #fff; border-right:4px solid #fff;} .pillar .b1 {margin:0 2px; background:#fff;} .pillar .b2 {margin:0 1px; border-width:0 1px;} .pillar .b3 {height:2px; margin:0;} .pillar .b4 {margin:0 2px;} .pillar .boxcontent {display:block; background:#d66; border-left:1px solid #fff; border-right:1px solid #fff; margin:0 5px;} /* Barrel cutout Borders*/ .barrel {background: transparent; width:40%; margin:0 auto;} .barrel h1, .barrel p {margin:0 10px;} .barrel h1 {font-size:2em; color:#fff; letter-spacing:1px;} .barrel p {padding-bottom:0.5em;} .barrel .top, .barrel .bottom {display:block; background:transparent; font-size:1px;} .barrel .b1, .barrel .b2, .barrel .b3, .barrel .b4, .barrel .b5 {display:block; overflow:hidden; height:1px; background:#e0cea3;} .barrel .b1 {border-left:10px solid #dfd5c0; border-right:10px solid #dfd5c0;} .barrel .b2 {border-left:5px solid #dfd5c0; border-right:5px solid #dfd5c0;} .barrel .b3 {border-left:3px solid #dfd5c0; border-right:3px solid #dfd5c0;} .barrel .b4 {border-left:2px solid #dfd5c0; border-right:2px solid #dfd5c0;} .barrel .b5 {border-left:1px solid #dfd5c0; border-right:1px solid #dfd5c0;} .barrel .b1 {margin:0 33%;} .barrel .b2 {margin:0 20%;} .barrel .b3 {margin:0 12%;} .barrel .b4 {margin:0 5%;} .barrel .b5 {margin:0 1px;} .barrel .boxcontent {display:block; background:#e0cea3; border-left:1px solid #fff; border-right:1px solid #999;} </style> HTMl <body> <div id="info"> <h2>Corners</h2> <div class="raised"> <b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b></b> <div class="boxcontent"> <h1>3D Raised</h1> <p>Rounded corners with raised borders</p> </div> <b class="bottom"><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></b> </div> <p></p> <div class="inset"> <b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b></b> <div class="boxcontent"> <h1>3D Inset</h1> <p>Rounded corners with inset borders</p> </div> <b class="bottom"><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></b> </div> <p></p> <div class="pillar"> <b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b2"></b><b class="b4"></b></b> <div class="boxcontent"> <h1>Pillar shape</h1> <p>Corners to give a rounded pillar effect.</p> </div> <b class="bottom"><b class="b4"></b><b class="b2"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b></b> </div> <p></p> <div class="square"> <b class="top"><b class="b1t"></b><b class="b2"></b></b> <div class="boxcontent"> <h1>Square cutout Border</h1> <p>A box with cutout corners</p> </div> <b class="bottom"><b class="b2"></b><b class="b1b"></b></b> </div> <p></p> <div class="chamfer"> <b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b><b class="b5"></b></b> <div class="boxcontent"> <h1>Chamfer Border</h1> <p>A 45 degree border</p> </div> <b class="bottom"><b class="b5"></b><b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b></b> </div> <p></p> <p></p> <div class="curved"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent"> <h1>Curved cutout Border</h1> <p>A box with cutout corners</p> </div> <b class="bottom"><b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b></b> </div> <p></p> <div class="serif"> <b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b></b> <div class="boxcontent"> <h1>Flared shape</h1> <p>Corners to give a serif effect.</p> </div> <b class="bottom"><b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b></b> </div> <p></p> <p></p> <div class="barrel"> <b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b><b class="b5"></b></b> <div class="boxcontent"> <h1>Barrel shape</h1> <p>A box with top and bottom bulges.</p> </div> <b class="bottom"><b class="b5"></b><b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b></b> </div> </div></body> |
|
#2
|
||||
|
||||
|
WOW! I would really like to blog about this, do you have a link I could include to your site, or could I even redistribute it, of course I would give 100% of the credit to you.
Even if not, that is great css code. Thanks, Greg
__________________
PORTFOLIO: http://gregponchak.com[/SIZE] |
|
#3
|
||||
|
||||
|
You're tahoma font declaration would never be called - since all browsers have sans-serif as default.
You're multiple redundant class heavy, a LOT of CSS reduction could be applied there. ... and you've got multiple H1's and a H2 as your overall header? That's backwards. Give me a few, I'll post up something a little... leaner. It is fun playing with these though, isn't it? Last edited by deathshadow; Jun 26th 2007 at 4:06 pm. |
|
#4
|
||||
|
||||
|
Hmm. You know normally I'd use div's since they are block, and don't like the idea of using a meaningful tag like B for no content, but it did occur to me that I might want to put this inside an anchor, which my version of what you did is going to attempt - with a hover state... I think I'd still prefer span, but there's no reason you can't use B, so I'll go with the crowd on this.
I'll likely be posting up my version of this shortly. It shaves a couple k or so off the codebase via class reduction. |
|
#5
|
||||
|
||||
|
Ok, here's how I'd code those... It's a K or so less code despite having some additional styling and having actual formatting in the code.
http://battletech.hopto.org/html_tutorials/rounded_css_borders/more_styles.html It's also more modular, the colors are not hardcoded into the classes that make the shapes. For real fun, check out the :hover state one that switches between inset and raised. |
|
#6
|
||||
|
||||
|
hmmm thanks for your information i actually like that so i thought to share that with DP members if you need a screen shout than i can mention that as well
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| image by using CSS | Jalpari | CSS | 2 | Apr 30th 2007 11:16 am |
| CSS Image Hover in 1 Image File | jehzlau | CSS | 4 | Apr 11th 2007 10:01 am |
| 120000 photoshop shapes only for $3 | hasan | Content | 3 | Mar 5th 2007 8:46 pm |
| Random Background image, preload image using css | SLM-why | CSS | 7 | Feb 8th 2007 5:20 pm |
| Over 7,000 Photoshop shapes! {must see} | lassie911 | Buy, Sell or Trade | 9 | Dec 17th 2006 7:20 pm |