Link to home
Start Free TrialLog in
Avatar of PMH4514
PMH4514

asked on

CSS DIV Border - inside rather than outside?

I only care about IE7 (a proprietary / embedded web app). I know how to use javascript to change the border of a DIV on rollover, but the problem is that the border appears around the outside of the DIV. Is there a way to specify that the border should go around the inside only?  (like in Photoshop, the Stroke command, you can choose to stroke outside, inside or middle. )

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of apresto
apresto
Flag of Italy image

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
Each browser has its default behavior of displaying borders in HTML, either around div or table, and we cannot change it using CSS or any coding method, as far as I know.

There are no further settings like we have in PhotoShop.

If you feel that your div appears slightly bigger with this border, you can subtract that value from div's width.
e.g. Suppose you want to display a div of 100px width, but with 1px border around it is appearing as 102px, just use 98px width div.

:-)
side note - make sure you include a doctype decalration in your html, so that you persuade the browser (specifically IE) to render in standards mode. That way your size/border calculations will be consistent between browsers.
Avatar of PMH4514
PMH4514

ASKER

which doctype specifically?

I was able to accomplish my needs by way of a standalone DIV that I set to the proper location/height/width etc based on mouse location. (the mouse moves over a grid of images and must "highlight" them with a box.  

Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

should do the trick. however, i would always encourage strict xhtml :)