Link to home
Start Free TrialLog in
Avatar of minnirok
minnirok

asked on

Inner border for a div?

Hi,

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?

Thanks
Avatar of BogoJoker
BogoJoker

Hi minnirok,

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

The style of the border domain giving a slight padding and the border
[css]
div.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;
Avatar of minnirok

ASKER

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?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of BogoJoker
BogoJoker

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That border-width should probably have units:
2px
I tryed to fix it before I submitted, apparently not =)
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.