Re: A question about css

Discussion in 'HTML' started by dorayme, Mar 8, 2010.

  1. dorayme

    dorayme Guest

    In article <4b949153$0$1116$>,
    "Paul" <> wrote:

    > In my website I have tables with lots of cells like this sample:
    > <td width="20%"><center><font size="2" face="Verdana">
    > <a href="http://www.mywebsite.com/my-html-pages/page01.html">
    > <img src="http://www.mywebsite.com/images/image01.jpg"
    > title="description of image"><br>
    > Description-of-this-cell
    > </a>
    > </td>
    >
    > So there are many instructions inside the cell like this
    >
    > <td width="20%"><center><font size="2" face="Verdana">
    >
    > that are identical to those written in all the other cells. And I know that
    > this is wrong.
    >
    > Can you please suggest me a css sample to write these instructions only one
    > time for all cells? Thank you.
    > Paul


    How best to approach this depends rather on the actual table.
    Yes, you can take the approach that Richard has suggested, namely
    to class each individual cell you want with like <td
    class="price"> and style to the class with like td {text-align:
    center; ...;}. But in practice, there may well be easier ways.

    When classing, is there some name you can use that captures the
    type of data in the cell? That would make it likely that the
    cells might all be in one column. If you know the sort of data
    that goes in there, for example, a 7 digit phone number with
    spaces for readability, there is hardly a need to class all the
    cells in that column. One sensible thing to do would be to style
    *just one* of the cells, it could nicely be the relevant th. For
    the reasonable purpose of the number not wrapping? And style for
    it with an em width to guarantee enough for 7 digits and spaces.
    This one strategic styling combines with the built in machinery
    of html tables (or call it the magic of tables) to get the
    behaviour wanted.

    In other words, what you do with a table depends a lot on the
    case, there are often smarter ways to proceed than burdening lots
    and lots of cells with classes...

    --
    dorayme
     
    dorayme, Mar 8, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    4
    Views:
    750
    clintonG
    Dec 24, 2004
  2. tom watson

    print.css and screen.css

    tom watson, Sep 9, 2003, in forum: HTML
    Replies:
    1
    Views:
    484
    Jukka K. Korpela
    Sep 9, 2003
  3. Replies:
    6
    Views:
    565
    Jonathan N. Little
    Mar 18, 2006
  4. AF
    Replies:
    17
    Views:
    619
    Nije Nego
    Aug 9, 2006
  5. richard
    Replies:
    12
    Views:
    776
    dorayme
    Mar 9, 2010
Loading...

Share This Page