473,385 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why is it that 100% width looks like 95%?

Why is it that when I put one HTML element in another, say a table in a page,
set the outer element's margin and padding to 0 and the inner element's width
to 100%, the inner element's right edge does NOT rest at the outer element's
right edge? If you set the width of the inner element to 105%, it looks
right. Huh? What am I missing? TIA.
Nov 19 '05 #1
3 1837
Is there an extra space or return in the HTML file? Sometimes spaces between
the ending tags of the control can cause that problem. For example, you want
the following:

</table></body>

NOT </table>
</body>

Same with your <tr> and <td> tags as well.

--

Joshua Mitts
jo****@msn.com

"William Sullivan" <Wi*************@discussions.microsoft.com> wrote in
message news:9F**********************************@microsof t.com...
Why is it that when I put one HTML element in another, say a table in a
page,
set the outer element's margin and padding to 0 and the inner element's
width
to 100%, the inner element's right edge does NOT rest at the outer
element's
right edge? If you set the width of the inner element to 105%, it looks
right. Huh? What am I missing? TIA.

Nov 19 '05 #2
Joshua Mitts wrote:
Is there an extra space or return in the HTML file? Sometimes spaces between
the ending tags of the control can cause that problem. For example, you want
the following:

</table></body>

NOT </table>
</body>

Same with your <tr> and <td> tags as well.

--

Joshua Mitts
jo****@msn.com

"William Sullivan" <Wi*************@discussions.microsoft.com> wrote in
message news:9F**********************************@microsof t.com...
Why is it that when I put one HTML element in another, say a table in a
page,
set the outer element's margin and padding to 0 and the inner element's
width
to 100%, the inner element's right edge does NOT rest at the outer
element's
right edge? If you set the width of the inner element to 105%, it looks
right. Huh? What am I missing? TIA.


Apologies, I cannot see the original post, only this answer. In short,
the answer is "because browsers are odd". Even when (if?) you manage to
get everything laid out exactly how you want it in e.g. Internet
Explorer, you'll find it renders differently in Opera and Firefox. That
doesn't stop the bloody analysts in my shop insisting that everything
has to be "just so". I gradually guide them towards making the user
experience good, and the layout reasonable.

(Worst experience was one analyst who didn't want any scrollbars, so
had designed every webpage to sit on one page of the spec. Portrait.)

But to try to answer the original question:
1) Do you have enough content to fill the inner element? Sometimes if
you only have a single line of text, the element will get shortened
anyway.
2) Try turning on borders on everything - this can often expose that
the element you believe is responsible for layout problems isn't
3) Is the table well-formed? Are the number of rows/columns consistent
(can especially turn up when using rowspan/colspans > 1)

Damien

Nov 19 '05 #3
Try using pixels px.
Patrick
..

"William Sullivan" <Wi*************@discussions.microsoft.com> wrote in
message news:9F**********************************@microsof t.com...
Why is it that when I put one HTML element in another, say a table in a page, set the outer element's margin and padding to 0 and the inner element's width to 100%, the inner element's right edge does NOT rest at the outer element's right edge? If you set the width of the inner element to 105%, it looks
right. Huh? What am I missing? TIA.

Nov 19 '05 #4

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

Similar topics

2
by: patrick h. | last post by:
Greetings, I am encountering some issues regarding using float while desiring to set the height to 100%. This is likely due to my own misunderstanding of the way things actually function -- any...
5
by: Chris Leipold | last post by:
Hi, I have a problem with an element of 100% width and a left paddig. The effect I try to achieve is easy, take a look at: http://swing-tanzen-verboten.de/test.html My Problem is, the width...
4
by: Hiwj | last post by:
I am having a problem with a cell in a table in ASP.NET which used to work OK in classic ASP. I have one cell in a row where the width should be 22 pixels and the other cell should take up the...
2
by: James Frayne | last post by:
Hi, I am trying to integrate phpBB into my existing site design. I am doing this simply by pasting fragments of my HTML into the phpBB templates. This works fine in Firefox and Opera but the...
17
by: Mike | last post by:
I'm trying to create a page: Three sections (left, topright and bottomright), each with a heading and scrolling (overflow) content. The size of these sections should be based upon the size of the...
0
by: mephraim | last post by:
I have a page at (view in IE): http://rmc2.dev.leepfrog.com/ie_fix_me/index.html that has an image floated right outside of a main content div that looks like: <img src="blah" style="float:...
1
by: Mike Collins | last post by:
I am trying to create some pages and have them take 100% of the window, but I cannot get 100% to work. If I set the height of my div, the page displays a scroll bar and it looks like I set the...
2
by: Amzul | last post by:
hello all i search the net for upload picture secure code i fuond this code, and affter i changed it abit it looks like that : <?php class image_upload { var $tmp_image; var...
1
by: psion | last post by:
Hi, We have a gridview on a webpage, which we would like to be 100% of the table cell in which it is placed. When we specify the width to be 100%, this has no effect, but only if we specify a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...

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.