Inner border for a div?


Is there any tag for creating a 1px inner border for a div? I know we have the normal border itself, anything for an inner border? If not, what's the simplest way to get such an effect?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi minnirok,

I think this might be a little crude but how about a little border div:
<div id="main">
  <div id="border">

The style of the border domain giving a slight padding and the border
  padding: 1px;
  border: 1px solid black;

I don' think that is what you want but its a suggestion.

Joe P
instead of padding it shold probably be margin: 0;
minnirokAuthor Commented:
That could work, I was thinking I'd have to do this since I've never seen an inner border style attribute. I'm trying to change the border color dynamically with javascript, and this works in IE:

    document.getElementById("div_5").style.borderWidth = '2';
    document.getElementById("div_5").style.borderColor = 'red';

No luck in firefox, any ideas?

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

That should work, just it should be:
document.getElementById("div_5").style.border-width = '2';
document.getElementById("div_5").style.border-color= 'red';

Here is a good source for all the tags:
Notice that it moves you right to the border CSS attributes on that page, but that should be ALL CSS2 thingies

Joe P

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
That border-width should probably have units:
I tryed to fix it before I submitted, apparently not =)
minnirokAuthor Commented:
aweseome thanks as always
No problem =)

Joe P

Note: Although the comment you accepted was good, try to accept the comment that was the answer to the question, [int his case probably the first comment], that way if someone searchs the site in the furute, they will find the same solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.