Forum Moderators: open

Message Too Old, No Replies

avoiding nbsp on the entire web page

html nbsp

         

ksugam

9:12 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



Hello,
I have lots of nbsps on the webpage to get the proper formatting...
Correct me if i am wrong, using nbsps can be dangerous on different browsers as the result might vary...

I have fixed number of nbsps for a particular row or column...but the data is coming from mysql...so the length of data varies...
so for each column in a table, the code for the result looks like this:

'data'    

Is there a more reliable way to do this.....

Fotiman

9:44 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is this not basically the same question you asked in this thread:
[webmasterworld.com...]
?

ksugam

9:56 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



so does tht mean i shd replace the <table> with <div>?

ksugam

10:05 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



anyways, i figured it out...i should have used cellpadding and cellspacing instead of nbsp

penders

11:20 am on Feb 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



...i should have used cellpadding and cellspacing instead of nbsp

cellpadding/cellspacing and &nbsp; (non-breaking space) are two very different things. It sounds as if you were using &nbsp; characters to control the width of the element?

An alternative to using &nbsp; characters might be to use the CSS

white-space
property to suppress line breaks. eg:
#container { 
white-space:nowrap;
}

BlobFisk

1:01 pm on Feb 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, cellspacing and cellpadding on the table element are deprecated attributes!

penders

2:45 pm on Feb 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Also, cellspacing and cellpadding on the table element are deprecated attributes!

Are you looking ahead to HTML5? As they aren't deprecated in HTML4.01.

Trace

2:54 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



If you insist on using tables, you shouldn't be using nbsp's to force the width of a cell. Instead, just set it's with with the style property;

<td style="width:100px;"> </td>

BlobFisk

8:55 am on Feb 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



XHTML! You're correct, it's ok to use them in HTML4.01.

I like to keep all my visual control at the CSS end so that my markup is clean and as semantic as possible.

penders

5:59 pm on Feb 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



XHTML!

Are you saying cellpadding and cellspacing are deprecated in XHTML1.0? Are you sure?!

Trace

8:19 pm on Feb 7, 2008 (gmt 0)

10+ Year Member



<!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" xml:lang="en" lang="en">
<head>
<title>test</title>
</head>
<body>
<table cellpadding="0" cellspacing="0">
<tr>
<td>Lorem ipsum</td>
</tr>
</table>
</body>
</html>

This Page Is Valid XHTML 1.0 Strict!

I had to actually try it, you guys got me so confused.

BlobFisk

9:45 am on Feb 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry about that - my bad.