473,695 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOCTYPE Strict uses "correct" box model - so why is 100% width now useless?

Consider this simple HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Strict kills my widths!</title>
</head>
<body>
<table style="width:40 0px; table-layout:fixed;">
<colgroup>
<col style="width:50 %;"/ >
<col style="width:50 %;"/ >
</colgroup>
<tr>
<td>
<input type="text" style="width:10 0%;" />
</td>
<td>
<input type="text" style="width:10 0%;" />
</td>
</tr>
</table>
</body>
</html>
Both text boxes have their right edges clipped off. Sure, the "Proper"

box model says that width is the width of the content, excluding the
padding and border (and margin, of course.) Wonderful. So now, with
all standard text boxes (and many other controls) having things like
padding and borders, what good is a percentage width?
I could (and do, for lack of a better workaround) use a slightly
smaller width, like 98%, but that has to be adjusted depending on the
width of the table and how many columns it has - smaller tables require

even more reduction in percentage width for the text boxes to fit.
I know the geniuses in the W3C think that their box model is the best,
but if you draw a box (essentially a border) and then write some text
in the middle of it with some space between the edge of the box and the

text, then ask any kid to measure the width of the box, he'll measure
from border to border, INCLUDING padding!
I know, I should stop whining and just stop using STRICT, right? Well,

I could, but that's a step backwards and there are other parts of the
strict doctype that are very appealing.
There's got to be a viable solution to this. Sure, 100% minus padding
minus border is the real answer, but since that's not possible (without

using dynamic properties) to put specify such a formula as width, how
can I solve this issue?
I FEEL LIKE I'M TAKING CRAZY PILLS!

Mar 28 '06
50 6049
Transitional is exactly what I'm trying to get away from.

Apr 3 '06 #11
While it would work for DIV (as I noted in a previous post), setting
style="display: block; width:auto;" does not work for TextBox objects in
IE6. This will result in the textbox width equalling the size of the
initial value text set upon page load. I've added a DIV and a TextBox
with display:block;w idth:auto to my sample pages:

http://www.digitolle.net/google/hotboxmodelaction.htm

Also, using width:auto on a DIV does not solve the problem of
percentages other than 100%, for instance, how would you do things like
50%?

Apr 3 '06 #12
Gérard, do you have a reply to my Fri, Mar 31 2006 1:13 am post?

Apr 3 '06 #13
In article <11************ **********@i40g 2000cwc.googleg roups.com>,
"Shadow Lynx" <sh**********@y ahoo.com> wrote:
While it would work for DIV (as I noted in a previous post)


No offense but:

<http://www.safalra.com/special/googlegroupsrep ly/>
<http://cfaj.freeshell. org/google/>
<http://oakroadsystems. com/genl/unice.htm>

leo

--
<http://web0.greatbasin .net/~leo/>
Apr 3 '06 #14
Shadow Lynx wrote:
While it would work for DIV (as I noted in a previous post), setting
style="display: block; width:auto;" does not work for TextBox objects in
IE6. Also, using width:auto on a DIV does not solve the problem of
percentages other than 100%, for instance, how would you do things like
50%?


.... just don't ignore the /rest/ of my post (which you failed to quote).

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Apr 3 '06 #15
VK

David Dorward wrote:
{
display: block; /* Default for most
things you want want
to do this with */
width: auto; /* Ditto */
}

<http://www.pacificnet. net/~johnr/cgi/aesop1.cgi?sel& TheFoxandtheGra pes2>
;-)

Apr 3 '06 #16
Leonard, None taken, and thanks for the interesting sites. Even so,
netiquette is often a matter of preference, and I prefer to not
duplicate posts that already exist. I must admit, though, that I
thought Google Group's reply editor was a bit smarter in how it placed
replies in the thread tree (I assumed that posts were shown in thread
then date order, not simply date order.)

Now that we've visited the whole replying ideology, do you happen to
have any comments related to this conversation?

Apr 4 '06 #17
I must be confused. The only part of your post that I didn't directly
address was "The other technique is to wrap the content in a divs to
which you apply the margin/padding/border instead." Perhaps I'm not
certain of what you mean, but, if you look at my example page at
http://www.digitolle.net/google/hotboxmodelaction.htm you'll see that
placing a TextBox or DIV into a parent DIV doesn't help the situation.

David Dorward wrote:
Shadow Lynx wrote:
While it would work for DIV (as I noted in a previous post), setting
style="display: block; width:auto;" does not work for TextBox objects in
IE6.

Also, using width:auto on a DIV does not solve the problem of
percentages other than 100%, for instance, how would you do things like
50%?


... just don't ignore the /rest/ of my post (which you failed to quote).

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Apr 4 '06 #18
Shadow Lynx wrote:
Leonard, None taken, and thanks for the interesting sites.
Who is Leonard?
Even so,
netiquette is often a matter of preference, and I prefer to not
duplicate posts that already exist.
And I prefer to have some context so I know what the hell people are
talking about
I must admit, though, that I
thought Google Group's reply editor was a bit smarter in how it placed
replies in the thread tree (I assumed that posts were shown in thread
then date order, not simply date order.)
I don't know what Google Groups does, since I don't use it.

Now that we've visited the whole replying ideology, do you happen to
have any comments related to this conversation?


Plenty, but I doubt you want to hear them.
Apr 4 '06 #19
Shadow Lynx wrote:
Leonard, None taken, and thanks for the interesting sites. Even so,
netiquette is often a matter of preference,
Netiquette is netiquette. Why would you want to disregard what is common
throughout Usenet?
and I prefer to not duplicate posts that already exist.
Do you mean you prefer to not quote what you are replying to? Be
prepared for lots more posts like this.
I must admit, though, that I thought Google Group's reply editor was a
bit smarter in how it placed replies in the thread tree (I assumed
that posts were shown in thread then date order, not simply date
order.)
This is not a web site or web page. This is Usenet. We are all using
newsreaders and an NNTP connection to the Usenet servers.
Now that we've visited the whole replying ideology, do you happen to
have any comments related to this conversation?


I've reread the entire thread and I still don't know what the real
question is.

--
-bts
-Warning: I brake for lawn deer
Apr 4 '06 #20

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

Similar topics

4
26208
by: N. Demos | last post by:
The following code renders as intended in IE (A TABLE, with cells of fixed width and height, inside of a DIV with fixed width and height and overflow set to hidden.) In Firefox, the table cells assume a narrower with than specified. If I comment out the width for the DIV, then the cells render with the correct width and height. Why is this happening? Thanks. Regards, N. Demos
1
1933
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Strict kills my widths!</title> </head> <body> <table style="width:400px; table-layout:fixed;">
4
1472
by: metaperl | last post by:
I work at a place which is currently running SQL 2000, but they are planning to migrate to 2k5. I was thinking that this is the perfect opportunity to fix all the weaknesses we have had in our data model for the longest: primary keys and foreign keys with different names, use of character columns for boolean fields, use of integer columns for toggles, no referential integrity, etc. So, even if I create my Utopian perfect data model and...
0
8587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9140
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
9005
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
8867
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,...
0
7688
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5847
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
4351
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
4599
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2291
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.