ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   HTML: Use CSS to change only left and right CELL PADDING ? (https://www.scoobynet.com/computer-and-technology-related-34/536080-html-use-css-to-change-only-left-and-right-cell-padding.html)

spectrum48k 14 August 2006 12:50 AM

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

RichB 14 August 2006 09:12 AM

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.... :rolleyes:

spectrum48k 14 August 2006 03:16 PM

I'll give it a try

spectrum48k 14 August 2006 06:01 PM

didn't work

(I'm using firefox)

mykp 14 August 2006 06:48 PM

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>

RichB 15 August 2006 09:28 AM

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'.

spectrum48k 15 August 2006 06:26 PM


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 ?

spectrum48k 15 August 2006 06:28 PM


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? :wonder:

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.

RichB 15 August 2006 06:32 PM

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?

spectrum48k 15 August 2006 06:40 PM

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*

EP82 15 August 2006 08:05 PM

I use margin?

spectrum48k 15 August 2006 10:20 PM

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


All times are GMT +1. The time now is 05:29 AM.


© 2024 MH Sub I, LLC dba Internet Brands