Almost 3d Blocks - Using CSS borders

free web hosting
Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

Almost 3d Blocks - Using CSS borders

FirefoxRocks
It's kind of simple, but I think it is cool anyways. Using CSS border properties, you can make an element look 3D.

Here's the code:
CODE
li {
    border: solid #000;
    border-left-width: 1px;
    border-bottom-width: 1px;
}

In this case, I have styled the list-item element to have a solid black border. The left and bottom side will only be 1px thick in order to make a difference between those and the top/right borders.

This line, border: solid #000 , has no width set. I figured out that most browsers default to a 3px border with an unspecified width (give or take a few pixels). By setting the left/bottom border to 1 pixel, it will give the right/top borders a thicker look, creating a 3D effect.

A change you can make to this is instead of thin left/bottom borders, you can have thin right/bottom borders. They will now look to be "pointed" left. I'm thinking that it will look nicer with right-to-left pages, but I'm not sure.

I have found that setting the top border to be the thin one doesn't look as good as this is intended to create a visual effect, and most people read downwards instead of upwards.

Experiment with CSS and you'll find really cool things you can do!

(This is compatible with all CSS supporting browsers.)

 

 

 


Reply

Mordent
I haven't tried that bit of code out yet, but on first inspection I'm sure there are more "standard" ways of making things look 3D. For example, this page lists a whole stack of border styles (groove, ridge, inset and outset all containing "Defines a 3D <###> border" as the first part of their description).

From past experience, the borders they give are often all you really need. Still, how that compares with your suggested style I'm unsure of. I might try it out tomorrow morning and give a little more feedback then.

Reply

FirefoxRocks
I've reviewed that list and basically it all comes down to appearance and control. I mean groove looks like something has been imprinted with a stamp, and inset and outset have their own unique way of popping in (or out). But by using my technique, you can almost emulate the 3D effects used in some versions of Microsoft PowerPoint.

Reply

Jeigh
Yea it's amazing what css can do when you get creative. There are a lot of built in things but a ton of little tricks like you did that present some interesting and quite great results if you just use the available customizations in creative ways and combinations. I know I've personally used endless combinations of things to get weird results just because I was too lazy to look up the more standard ways to do things or to make my own way look a little different then the 'normal' way to do it. If you can find a custom way to do something using CSS, goto town haha.

Reply

TavoxPeru
QUOTE(FirefoxRocks @ May 25 2008, 12:55 PM) *
It's kind of simple, but I think it is cool anyways. Using CSS border properties, you can make an element look 3D.

Here's the code:
CODE
li {
    border: solid #000;
    border-left-width: 1px;
    border-bottom-width: 1px;
}

In this case, I have styled the list-item element to have a solid black border. The left and bottom side will only be 1px thick in order to make a difference between those and the top/right borders.

This line, border: solid #000 , has no width set. I figured out that most browsers default to a 3px border with an unspecified width (give or take a few pixels). By setting the left/bottom border to 1 pixel, it will give the right/top borders a thicker look, creating a 3D effect.

A change you can make to this is instead of thin left/bottom borders, you can have thin right/bottom borders. They will now look to be "pointed" left. I'm thinking that it will look nicer with right-to-left pages, but I'm not sure.

I have found that setting the top border to be the thin one doesn't look as good as this is intended to create a visual effect, and most people read downwards instead of upwards.

Experiment with CSS and you'll find really cool things you can do!

(This is compatible with all CSS supporting browsers.)

Some years ago when i work with Fox Pro, I remember that for boxes needed on screen you create it by drawing manualy each one and setting things like its border colors and using an almost similar technique to have a 3D look.

Instead of yours i prefer this one:

CODE
li {
    font-size: 0.75em;
    list-style-type:none;
    margin:0px 0px;
    padding:0px 0px;
    border: 2px solid #000;
    border-left:1px solid rgb(192,192,192); border-top: 1px solid rgb(192,192,192);
    width:20em;
    text-align:center
}

The list-style-type determines which list item marker will be used and setting it to none hides the list item market of each item. If you want to separate with some space between each list item simply increase the margin to 10px 0px.

Also, if you want to add an hover effect you can do it using a little javascript function that for example reverse the borders.

Best regards

 

 

 


Reply

FirefoxRocks
QUOTE(TavoxPeru @ May 29 2008, 06:59 AM) *
Some years ago when i work with Fox Pro, I remember that for boxes needed on screen you create it by drawing manualy each one and setting things like its border colors and using an almost similar technique to have a 3D look.

Instead of yours i prefer this one:

CODE
li {
    font-size: 0.75em;
    list-style-type:none;
    margin:0px 0px;
    padding:0px 0px;
    border: 2px solid #000;
    border-left:1px solid rgb(192,192,192); border-top: 1px solid rgb(192,192,192);
    width:20em;
    text-align:center
}

The list-style-type determines which list item marker will be used and setting it to none hides the list item market of each item. If you want to separate with some space between each list item simply increase the margin to 10px 0px.

Also, if you want to add an hover effect you can do it using a little javascript function that for example reverse the borders.

Best regards


That would be good if you actually want the bullet/number to be hidden, but the point is that this could have been applied to other elements such as paragraphs, divs, etc. Also, I used minimal code to avoid confusion in the example.

Reply

TavoxPeru
The following pages shows some live examples:Best regards,

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : 3d, blocks, css, borders

  1. Locking Background Image To Browser Borders.
    (7)
  2. How Do You Show..
    borders for frames in Firefox? (11)
    Okay, I don't know if it's because of the Firefox browser not supporting this part of the
    HTML code, which I doubt, since it shows up just fine around text, but not sections where graphics
    are. Anyways, here's what the layout looks like in IE: And what it looks like in Firefox:
    And here's the code I'm using that wants to screw with my head, apparently: CODE
    style="border-right:2px solid #003300; border-top:2px solid #003300;
    border-left-width: 1; border-bottom-width: 1; padding: 0"> And that's ba....
  3. Putting Two Div Blocks Side By Side?
    CSS woes (9)
    Hi all~ Need some help with CSS. I'm trying to get two divs to reside side by side. Each div
    has a few lines of words and I need the two div blocks to be just next to each other if possible. I
    went through many methods and this is what I've come up with so far that works pretty well...
    The trial page is here . CODE <html><head> <style
    type="text/css"> #commentforma { margin-top: 2em; margin-bottom: 2em;
    margin-left: 2em; margin-right: 1em; text-align: center; float: left } #commentformb
    { margin-top....
  4. Netscapre Borders
    Css borders in netspace. (1)
    My borders are all weird when I do netscape, but they look fine in IE. Does anyone know what the
    difference is? (My website is not online yet, so I can't show you.) Do I have to do a tag
    around everything?....
  5. Html W/ Embedded Flash
    How do I get rid of borders?? (8)
    Hey if any of you HTML wizzes out there could help me - I would greatly appreciate it. I am
    designing some web site stuff with flash only. I know I know I should be using dreamweaver or
    something else in addition - which I don't have access to on my computer here at work. When I
    publish my files I can't get rid of the border around my swf file when I view it in a browser.
    Is there any way to get rid of this $#%$ed border?? I have tried all the options I can
    find in flash to no avail. I'm thinking there probably is some simple HTML code to get ....

    1. Looking for 3d, blocks, css, borders

Searching Video's for 3d, blocks, css, borders
advertisement




Almost 3d Blocks - Using CSS borders



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE