Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

HTML: Use CSS to change only left and right CELL PADDING ?

Thread Tools
 
Search this Thread
 
Old 14 August 2006, 12:50 AM
  #1  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default HTML: Use CSS to change only left and right CELL PADDING ?

Is it possible to adjust specifically the left and right side of the CELL PADDING command using CSS ?

I need top and bottom to be 0 px
I need left and right to be 15 px
Old 14 August 2006, 09:12 AM
  #2  
RichB
Scooby Regular
 
RichB's Avatar
 
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes on 0 Posts
Default

try something like
<style>td.blah{padding:0 15px;}</style>
<td class="blah">my stuff</td>

Problem is that IE will behave different to any other browser probably....
Old 14 August 2006, 03:16 PM
  #3  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

I'll give it a try
Old 14 August 2006, 06:01 PM
  #4  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

didn't work

(I'm using firefox)

Last edited by spectrum48k; 14 August 2006 at 06:04 PM.
Old 14 August 2006, 06:48 PM
  #5  
mykp
Scooby Regular
 
mykp's Avatar
 
Join Date: Jan 2006
Location: On the Cat and Fiddle
Posts: 1,483
Likes: 0
Received 0 Likes on 0 Posts
Default

try this



<table width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="border-top-width: 0px; border-right-width: 15px; border-bottom-width: 0px;border-left-width: 15px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid;">&nbsp;</td>
</tr>
</table>
Old 15 August 2006, 09:28 AM
  #6  
RichB
Scooby Regular
 
RichB's Avatar
 
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes on 0 Posts
Default

Do you really need a table? You should try and use CSS where ever possible unless of course you are displaying tabulated data. You shouldn't use tables for layout. Can be tricky to get right and working across browsers but the code you are left with is smaller, cleaner and more 'valid'.
Old 15 August 2006, 06:26 PM
  #7  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by RichB
Do you really need a table? You should try and use CSS where ever possible unless of course you are displaying tabulated data. You shouldn't use tables for layout. Can be tricky to get right and working across browsers but the code you are left with is smaller, cleaner and more 'valid'.
Really ? I've always used them and never gave it much thought.

Is it frowned up to use tables for general layout and alignment ?
Old 15 August 2006, 06:28 PM
  #8  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by mykp
try this
<table width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="border-top-width: 0px; border-right-width: 15px; border-bottom-width: 0px;border-left-width: 15px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid;">&nbsp;</td>
</tr>
</table>
Thanks, that works in Firefox - but doesn't in Internet Explorer?

I should add, I'm doing this from CSS and NOT directly directly in the code as you show above. I like the CSS approach as it allows me to apply global changes instantly.

Last edited by spectrum48k; 15 August 2006 at 06:31 PM.
Old 15 August 2006, 06:32 PM
  #9  
RichB
Scooby Regular
 
RichB's Avatar
 
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes on 0 Posts
Default

It does for me!(Both mac and pc)

Are you using IE on a Mac or PC? Mac IE is really really bad! IE on the PC is just really bad...

Care to give us more of the HTML or the URL so we can test/see it?

Last edited by RichB; 15 August 2006 at 06:38 PM.
Old 15 August 2006, 06:40 PM
  #10  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

HTML:

<table class="padded_leftright" width="750" align="center">

<tr>
<td><hr color="#ffcc00" size="3" width=100%></td>
</tr>

</table>



CSS:

table.padded_leftright {
vertical-align:top;
background-color:#000000;
padding-top: 6px;
padding-right: 20px;
padding-bottom: 6px;
padding-left: 20px;
border: 0px;
}


Just noticed your code is different, D'OH!

*scrambles off to try your code*

Last edited by spectrum48k; 15 August 2006 at 06:44 PM.
Old 15 August 2006, 08:05 PM
  #11  
EP82
Scooby Regular
 
EP82's Avatar
 
Join Date: Feb 2005
Posts: 333
Likes: 0
Received 0 Likes on 0 Posts
Default

I use margin?
Old 15 August 2006, 10:20 PM
  #12  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

all sorted

I was defining a class for the table when I should've defined a class for the <td>

Firefox permitted my mistake, but IE didn't
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Brumguy34
Subaru Parts
8
04 October 2015 07:51 PM
IAN WR1
ScoobyNet General
8
28 September 2015 08:14 PM
StueyBII
General Technical
4
26 September 2015 12:35 PM



Quick Reply: HTML: Use CSS to change only left and right CELL PADDING ?



All times are GMT +1. The time now is 08:49 PM.