Help - Search - Members - Calendar
Full Version: Tables and such
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
exentrix.
Hey there, i've been slowly coding this layout and i was wondering if someone could help me with some HTML issues.
Here's the link:

http://1312.nytka.org/layout/index2.php

In particular I could use help with adding 'cell padding' to the content areas. The problem with doing this is that on the 'Featured Article' section i need 0 cell padding, where as on other cells/rows in the table '5' would be good.
The question is, is there anyway to change the padding on individual cells within a table?

Any other suggestions are welcome. smile.gif
pandy
Yes, with CSS. CSS lets you control padding and borders of each cell individually.
http://htmlhelp.com/reference/css/
http://htmlhelp.com/reference/css/box/padding.html
exentrix.
That looks like what i'm looking for.
How would i go about using that on the page i showed?
I've never really used CSS before.. looks complicated.

Guess i'm gonna have to start reading some tutorials.

Thanks for your help.
pandy
It isn't complicated, really. Not for simple things like this. Read the introductory chapters in the reference and you'll soon get the hang of it. You'd have to give the concerened TDs a class.

CODE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<title>CSS borders</title>

<style type="text/css">
<!--
td      { width: 8em; height: 8em;
          border: 1px solid gray }
.foo    { border-style: solid dashed dotted double;
          border-color: yellow red blue green;
          border-width: 10px 5px 15px 20px }
-->
</style>

</head>


<body>

<table>
   <tr>
       <td>
       Bla bla bla
       </td>
       <td class="foo">
       Bla bla bla
       </td>
       <td>
       Bla bla bla
       </td>
   </tr>
</table>

</body>
</html>
exentrix.
That's a lot of help, thanks a lot.
pandy
You are welcome a lot. smile.gif
exentrix.
=D

I know it's a bit unnecessary, but is it possible to apply more than 1 'class' to a tag (for example the <TD> tags).
Christian J
QUOTE(exentrix. @ Apr 24 2007, 05:33 PM) *

is it possible to apply more than 1 'class' to a tag (for example the <TD> tags).

Sure. You can use it like this:

CODE
p {color: black; background: white;}
p.foo {color: green;}
p.bar {background: red;}

<p class="foo">this should be green text on white background</p>
<p class="bar">this should be black text on red background</p>
<p class="foo bar">this should be green text on red background</p>

or like this (note the IE6 bug, don't know about IE7):

CODE
p {color: green;}
p.foo.bar {color: red;}

<p class="foo">this should be green</p>
<p class="bar">this should be green, but IE6 makes it red</p>
<p class="foo bar">this should be red</p>

exentrix.
That's pretty useful. Thank you, kind sir. biggrin.gif
pandy
Sooner or later you'll want to read about the CSS table model.
http://www.w3.org/TR/CSS2/tables.html
exentrix.
CSS is pretty amazing.

Thanks for that link, it might come in useful one day.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.