Jump to content

[SOLVED] Padding


jaymc

Recommended Posts

Im trying to make the HTML on my website as compliant as possible

 

My question is, should   be used to generate padding?

 

In my case, Im using it as a way of padding rather than using CSS or cellpadding=1

 

Using   is much easier, but could this cause problems?

 

I suppose its better than using the old, 1px transparent pixel, but should I really be doing this in CSS even though that will in itself mean more classes and drive me mad!

Link to comment
Share on other sites

you don't necessarily need more classes... try:

 

td, andwhateverelse {

    padding: 5px

}

 

yes you should be padding your cells with css rather than   unless you want to have to go find all those  's one day and remove them manually during a redesign.

Link to comment
Share on other sites

The only time you should be using &nbsp is when you have a table that is filled with tabular information (i.e. not page layout), but has an empty cell in it. Most browsers render fine without the $nbsp, but some need some content in that cell.

Link to comment
Share on other sites

don't ever use  , unless it's an empty cell in a table. - Very rare.

 

The problem with your idea, is that this will actually be text. So when some highlights all the code, they highlight, "blankness."

 

Remember CSS was created for visuals, pure html is supposed to be only used for content.

Link to comment
Share on other sites

The problem is I need different padding for different area

 

sometimes 1px to the left, others 2px to the left 5px to the right

 

So its not as if I can just add it into one class

 

Im either going to have about 20 css classes, or put style="padding-left:2px" for example in a lot of cells

 

Still think to go with doing that?

Link to comment
Share on other sites

Yep! Mark-up shouldn't have any presentation in it, and using nbsp is trying to style with your markup. It should be avoided.

 

Hmm, so what if there is some text that I want underlined and bold, would you create a css class just for that or use the <b><u> tags

 

same theory goes for aligning and text colouring, if its only going to be used for one string of text on the whole site, is it worth that class or just putting a style="..." in the tag

 

I just dont want to be adding 50 classes to sort out 50 seperate bits of text / position etc as they will only be used once

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.