473,800 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preparing to write a post that blasts CSS.


I figure before I go and write my summary of why you should go back to
tables and only use CSS for fonts and colors and stuff, I ought to make
sure I've got my facts right. So, please tell me how I can get this:

<div style="border:1 px solid #000;width:100% ">
<table style="backgrou nd:#CABE9E;
margin:10px 10px 10px 10px;
border-bottom:4px solid #000;
border-left:4px solid #000;
border-right:4px solid #000;
border-top:4px solid #000;
width:100%;">
<tr><td>some table stuff...</td><td>spills over in firefox, and
causes everpresent vertical scroll in IE</td></tr></table>
</div>

to look like this:

<table cellspacing="0" cellpadding="1" bgcolor="000000 "
width="100%"><t r><td>
<table bgcolor="ffffff " cellpadding="8" cellspacing="0"
width="100%"><t r><td>
<table bgcolor="000000 " cellpadding="4" cellspacing="0"
width="100%"><t r><td>
<table bgcolor="CABE9E " cellpadding="4" width="100%"><t r><td>some
table stuff...</td><td>spills over in firefox, and causes everpresent
vertical scroll in IE</td></tr></table></td></tr></table>
</td></tr></table>
</td></tr></table>

Try them in both IE and Firefox.

Apparently the spec for CSS says that the border and margins shouldn't
be counted when calcing the size of the div/table. Take a look at this
(these) bug reports:

https://bugzilla.mozilla.org/show_bug.cgi?id=258523

But IE does something bad too- notice that you get a horizontal scroll
bar at the bottom, no matter how wide your screen goes (with the CSS
version).

But the table version looks fine in both browsers.

Anyway, if I'm missing something that would fix this, tell me.

Jul 21 '05
10 1922
On 28/06/2005 06:32, dt******@hotmai l.com wrote:
All this says is that the "box width" is calculated by including the
margins and border. It doesn't say that when an outer div is deciding
how wide to be, it should include the inner div/table's border's and
margins.
The algorithm clearly states that an unconstrained block level element
will take all the space it can. So, with:

#outer {
width: auto;

/* These are normally the default: */
margin: 0;
padding: 0;
border-style: none;
}

<body>
<div id="outer">
...
</div>
</body>

the content area of #outer will span the complete content width of the
BODY element. If you then add inner block level elements with explicit
100% content widths, they will have the same width as #outer. If those
inner elements have margins, padding, or borders, then their content
width will be the same, but the dimensions of those added features will
then cause the box to overflow.

In the case you presented, the outer DIV element had a border and an
explicit 100% width. So, it's content width will be the same as the
viewport minus the margin/padding/border of the BODY element. The border
of that outer element will then add two pixels to that, extending it two
pixels beyond the right-hand edge of the BODY element.

Next, you had a TABLE element (though it could have been any block level
element) with a wide margin (10px), border (4px), and an explicit 100%
content width. As the values are over-constrained, the right margin is
ignored, but again the content width will be the same as the above, and
again we must add the extra box surroundings: a total of eighteen
pixels. Add that to the left border of the DIV element, and the TABLE
element will extend nineteen pixels beyond the right-hand edge of the
BODY element. As the right margin/padding of the BODY element will only
be ten pixels (in most cases), the TABLE will extend ten pixels off the
right-hand edge of the viewport.

[snip]
Seriously, look at the firefox bug url I gave you.


You did notice that it was marked as 'resolved invalid', didn't you?
That means the 'bug' is nonsense and Firefox is acting correctly.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 21 '05 #11

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

Similar topics

1
1191
by: tanya | last post by:
HI, I am trying to send out email blasts to over 6000 users of a website (Not Spam) However when I try it with the following script, it crashes at times and sends it through at times. I need a more reliable way of sending out emails to a large number and this is the mail feature of the website. There will be users trying to send out mails at the same time. Please help
4
1985
by: David | last post by:
A friend of mine has to export some data from his current access database into a CSV file to be imported into an accounting package. There are a few things that need to be done most of which I am quie capable of doing. For expample writing the query to grab all the relevant data is fine. Building the macro to export the data via transfertext is also fine. The problem I have lies in his product description field. In his database it is...
0
1158
by: matungafriend | last post by:
Hi I am fresher what kind of questions are asked during .NET Interviews how should i prepare myself.I have just completed my course from my NIIT and looking forward for real job. I am doing the following stuff 1) Preparing myself for certifications. 2) preparing interview questions from www.techinterviews.com , http://www.geocities.com/dotnetinterviews/ and freshers guide for .NET
4
2746
by: bennett | last post by:
How can I do a loop from 1 to 5, where on line 1 I print 1 space followed by a button, on line 2 I print 2 spaces followed by a button, on line 3 I print 3 spaces followed by a button, etc.? I tried this code: for (int i = 1; i <= 5 ; ++i) { for (int j = 1; j <= i; ++j) {
1
1368
by: culley harrelson | last post by:
Is there any benefit to preparing a call to a pre-defined sql function or is the sql function already optimized? create temp table foo(col1 integer); insert into foo(col1) values(1); insert into foo(col1) values(2); insert into foo(col1) values(3); insert into foo(col1) values(4); create or replace function testfunc(integer) returns foo as 'select * from foo where col1 = $1;' language sql;
3
8848
by: Jer425 | last post by:
Hello all, I'm trying to post to another page from asp.net and direct the user there. I've looked through the group and found a lot of information. The following code may work well for what I'm doing. Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click ** Response.Write("<!-- Include File='Example.aspx' -->")
0
1068
by: aprajitha | last post by:
Hi, What is the approach to be followed for preparing a fresh new installation kit for a server using the Microsoft Installer?
2
1505
by: Jeff Rush | last post by:
Forrester Research is doing a study on dynamic languages and has asked that Python be represented. As advocacy coordinator I've volunteered to drive this, collecting answers from the community and locating representatives to participate in interviews. The goal of the study is to: - identify the criteria to use for evaluating such languages - identify the relevant choices of dynamic languages - identify how the different dynamic...
0
1259
by: alipalengara | last post by:
Hi, I have crated a setup project with prerequisites (frmaework 3.5 and SQL express 2005) and i given some custom action for restoring the database. The Problem is that after installing the application, it will pop up a message for "Preparing to Instal.." at everytime when loading application. Can anyone help me out to avoid this popup? Thanks in advance... Ali PP
0
9691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6813
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.