Solved

CSS DIV Border - inside rather than outside?

Posted on 2009-04-01
5
14,541 Views
Last Modified: 2012-05-06
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!
0
Comment
Question by:PMH4514
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Accepted Solution

by:
apresto earned 125 total points
ID: 24039591
0
 
LVL 9

Expert Comment

by:knonie
ID: 24039626
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.

:-)
0
 
LVL 12

Expert Comment

by:alien109
ID: 24039864
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.
0
 

Author Comment

by:PMH4514
ID: 24039937
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!
0
 
LVL 12

Expert Comment

by:alien109
ID: 24039978
<!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 :)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question