472,354 Members | 1,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

white-space nowrap

I'm trying to layout a couple text input fields and their
corresponding labels without using a table. When I was trying to
debug my understanding of CSS, I was *very* surprised to see that
span's with borders behave counter-intuitively (IMHO) when using
style="white-space: nowrap;".

Below is a fairly small chunk of XHTML that demonstrates what I'm
talking about. What gives?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>HTML 4.01 &amp; CSS 2.0 Test Page</title>


<h1>&ldquo;nowrap&rdquo; Test</h1>
Here&rsquo;s a test of a <b>div</b> with style=&quot;white-space:
nowrap;&quot;: <hr />
<div style="white-space: nowrap; border: 1px solid black;">
Line 1<br />
Line 2</div>
<hr />So far, so good.<br />
<br />
Here&rsquo;s the same thing using a <b>span</b> with
style=&quot;white-space: nowrap;&quot;:
<hr /><span style="white-space: nowrap; border: 1px solid
black;">Line 1<br />
Line 2</span> <hr />Why is the border so foobar&rsquo;d? I would have
expected the
span to be enclosed in a box.<br />
<br />
In FP 2003 it previews with no border at all. In IE6 and Opera 7.23
the border
encloses the top, left, and bottom of line 1 and the top, bottom, and
of line 2.<br />
<br />
<br />
What I&rsquo;m trying to do: <hr />
<form action="css-sample.html">
<div style="white-space: nowrap; display: inline;">
<input type="text" size="10" id="First1" /><br />
<label for="First1" style="font-size: xx-small;">First</label></div>
<div style="white-space: nowrap; display: inline;">
<input type="text" size="10" id="Last1" /><br />
<label for="Last1" style="font-size: xx-small;">Last</label></div>
<hr /><br />
<br />
What I&rsquo;m forced to do: <hr />
<form action="css-sample.html">
<table style="border-collapse: collapse" cellspacing="0"
<td><input type="text" size="10" id="First2" /><br />
<label for="First2" style="font-size:
<td><input type="text" size="10" id="Last2" /><br />
<label for="Last2" style="font-size: xx-small;">Last</label></td>
<hr /></div>


Jul 20 '05 #1
0 15044

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

Similar topics

by: qwweeeit | last post by:
Hi all, I need to limit as much as possible the lenght of a source line, stripping white spaces (except indentation). For example: .. . max_move and AC_RowStack.acceptsCards ( self,...
by: Bob Bedford | last post by:
I've about 50`000 jpg images on a dir. Some images have a white frame, other only 2 white lines, sometimes vertically, sometimes horizontally. I've to show those image on a darkgrey background,...
by: gopal srinivasan | last post by:
Hi, I have a text like this - "This is a message containing tabs and white spaces" Now this text contains tabs and white spaces. I want remove the tabs and white...
by: headware | last post by:
I've been getting a strange bug occurring in my ASP.NET pages. If while waiting for a page to load, the user clicks a dropdown listbox that causes postbacks, the whole screen turns white and it...
by: Dennis D. | last post by:
Back a few decades the proper way to learn a language began with a white paper. Do they exist for dot net, or would a person begin by studying the compiler specs? Guess what I'm asking is: Where...
by: marfi95 | last post by:
I'm trying to implement some code in vb.net to allow the user to adjust the brightness or contrast on an image (through the use of a slider) that is already black & white in the bitmap. I have...
by: martin1 | last post by:
Hi, All, how to flash button with 2 color( eg. red and white)? then when user click button, the button stop flash and stay red color? Thanks
by: bmjnine | last post by:
Hi all, I am converting image files of various formats to JPEG using: System.Drawing.Image img = System.Drawing.Image.FromFile(myfilepath); Works great except that transparent GIF's are over...
by: origenes | last post by:
Hi forum, Below is a sample code that creates a "white" gif image. I want to know... why the background result color is FEFCFE intead of white (FFFFFF)? When I use imagecreate instead of...
by: ayan4u | last post by:
well i need to deal with white spaces in charecter arrays... with static arrays its fine.. char ss; cin.getline(ss, sizeof ss); .... //deals with white spaces
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.