473,503 Members | 1,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Borders - inside or out?

Hi-

I have a question that I haven't been able to find any info on:

If I have an element (say, a <divor a <table>) which is a certain
fixed width (let's say 500px).

If I add a CSS border of 2 px, does the element:

a) become 504px wide, or
b) does the inner area of the element become 496px wide?

Basically, I'm trying to find out of the border takes up space on the
outside or the inside of the element.

Any help would be appreicated!

Thanks,

Rob

Sep 29 '06 #1
4 33089

ch******@gmail.com wrote:
Basically, I'm trying to find out of the border takes up space on the
outside or the inside of the element.
Elements are things in the source code of the document. When they're
rendered onto the page we usually call them boxes. Look up "CSS box
model" for explanations - brainjar.com has one of the better ones.

As to your "inside or outside ?" question, then this si something that
IE infamously got wrong to begin with. make sure you research "IE
quirks mode rendering" too.

Sep 29 '06 #2
On 2006-09-29, ch******@gmail.com <ch******@gmail.comwrote:
Hi-

I have a question that I haven't been able to find any info on:

If I have an element (say, a <divor a <table>) which is a certain
fixed width (let's say 500px).

If I add a CSS border of 2 px, does the element:

a) become 504px wide, or
b) does the inner area of the element become 496px wide?
(a) for most things, but (b) for tables!
Basically, I'm trying to find out of the border takes up space on the
outside or the inside of the element.
On the outside generally speaking, but tables and tds are a bit
different. I suspect this goes back to HTML table attributes, where
"width" specifies "the desired width of the entire table".
Sep 29 '06 #3
thanks, Ben -- that's exactly what I was looking for!
Ben C wrote:
On 2006-09-29, ch******@gmail.com <ch******@gmail.comwrote:
Hi-

I have a question that I haven't been able to find any info on:

If I have an element (say, a <divor a <table>) which is a certain
fixed width (let's say 500px).

If I add a CSS border of 2 px, does the element:

a) become 504px wide, or
b) does the inner area of the element become 496px wide?

(a) for most things, but (b) for tables!
Basically, I'm trying to find out of the border takes up space on the
outside or the inside of the element.

On the outside generally speaking, but tables and tds are a bit
different. I suspect this goes back to HTML table attributes, where
"width" specifies "the desired width of the entire table".
Sep 29 '06 #4
Thanks, -- brainjar is a good resource.
ch******@gmail.com wrote:
Hi-

I have a question that I haven't been able to find any info on:

If I have an element (say, a <divor a <table>) which is a certain
fixed width (let's say 500px).

If I add a CSS border of 2 px, does the element:

a) become 504px wide, or
b) does the inner area of the element become 496px wide?

Basically, I'm trying to find out of the border takes up space on the
outside or the inside of the element.

Any help would be appreicated!

Thanks,

Rob
Sep 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4595
by: Jeff North | last post by:
I'm trying to print a tables' cell/row but when a cell/row is split across 2 pages the cell bottom/top border doesn't print on either page. Like this: +--------+-----------------------------+ | ...
4
8914
by: Konrad Viltersten | last post by:
As it isnow i have to use a syntax for my tables as: <table class = "some" border> and/or <table class = "some" noborder> Now, what i'd like to do is to make that border-thingy...
2
17779
by: Damian Arntzen | last post by:
I'm trying to suss out exactly how to assign borders to cells via C# into an Excel 2003 spreadsheet. I've been tinkering some more last night (Aussie time) and managed to figure out a lot more in...
1
5830
by: Glen Vermeylen | last post by:
Hi, For a project at school we have to automate the assignment of seats in classrooms to students during the exams. The lady who previously did everything manually kept the layouts of the...
1
1686
by: Turbot | last post by:
Hello, Anyone know how to draw HMTL style borders, such as ridge and groove, on a VB.NET control. I want to be able to draw borders of various styles, colours and sizes on a picture box or...
2
2179
by: alvarezp | last post by:
I've tried to search the lists for this, and even asked at www-style but I seem not to find anything and they didn't answer. This is about the borders in CSS3. Let's say I'm trying to draw a...
1
1488
by: prefersgolfing | last post by:
Though others may deride my style, I'm using style="... to set the borders in a table I've created. I've noticed when the <td> is empty, nothing in style="... seems to affect the borders. This is...
10
7708
by: Matt Kruse | last post by:
See: http://www.mattkruse.com/temp/offsetleft.html It appears that the offsetLeft value in IE6 (other versions not tested) incorrectly ignores the border width on a DIV when there is a width:...
3
1133
by: CharChabil | last post by:
Having a map I want to know if the user has clicked outside or inside the borders of the map Note that: the image containing the map is chosen as background of the form So I thought of something...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.