SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS to size table cells?

    I just discovered the superior method of using CSS to determine <TD> cell Heights and Widths. I was wondering if anyone could show me a page where they employed this technique so that I may look at the source code and learn from it. I'm having trouble conceiving how I can integrate external and internal style sheets to the same <TD> cell in order to separately call out the size of the cell with internal, and then use external to determine the text formatting for sitewide usage.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Location
    U.A.E.
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe you mean this:
    Code:
    <html>
    <head>
    <style type="text/css">
    td.test {height: 20px; width: 150px; background-color: green;}
    </style>
    </head>
    <body>
    <table>
    <tr><td class="test"></td></tr>
    </table>
    </body>
    </html>
    i dont know if thats what you want to see

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Almost got it!

    How would you then apply an external style to that same td cell at the same time in order to format text you put into it. You can't apply two styles in the same td cell right? So how then? I wouldn't want the text formatting in the internal style attribute because then I wouldn't be able to utilize it sitewide. That's what I'm fishing for.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Location
    U.A.E.
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't apply two styles in the same td cell right?
    yeah! right, so make it in the extrnal style sheet, its better than making to styles (enternal & extrnal).

  5. #5
    SitePoint Zealot DigitalCreation's Avatar
    Join Date
    Jun 2002
    Location
    'down under'
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would you then apply an external style to that same td cell at the same time in order to format text you put into it.

    Not 100% sure I'm reading your question right, but when applying the properties.. you could either apply both the td and text formating under one class ( which should be used if there is more than one instance) and place it in your external style sheet, so that class is already formatted. or if your asking if there is a possibility to format all of the td's, no matter if they are controlled by the class or not, then just add a td and the elements you want to define with in it.

    You can't apply two styles in the same td cell right? So how then?
    With difference to the post before mine, yes you can apply more than one style to one td, providing that you're not defining the same properties, and if you are providing the same properties, using an external would be sitewide, and comes last in the cascading order, then page based, which would be in the <style> tag, and then inline, which would affect that tag only. inline carries the highest order, and whatever was defined there would override any other style defined.

    I wouldn't want the text formatting in the internal style attribute because then I wouldn't be able to utilize it sitewide. That's what I'm fishing for.

    Then keep it external, set the properties for the td tag, your font, and or anything else you want to be the same sitewide, margins, size etc.
    then use a class for the td's that you would define the height width etc, ( saying class in assumption that you would have more than one with the same attributes) then inline or by id for something specific that would be on it's own.

    Hope that gives you a clearer picture, many others here have been in the css longer than I have, though I think if I understood your question, this would be the best approach.
    Robby aka D.C.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you digital

    Your intruction does clear things up quite a bit. The way I understand it, when I define the cell size formatting of td cells I should use an inline style and when I format the text within it I should use the external correct?

    Hey by the way digital, Why does this site review request from BlackDog look eerily like the style of your icon? I thought it was you that I critiqued when I saw the icon in this post but then I went and checked and it wasn't you. What's up with that?

    http://mywebpages.comcast.net/blckd...n/template.html
    Last edited by Rondavu; Sep 7, 2002 at 21:04.

  7. #7
    SitePoint Zealot DigitalCreation's Avatar
    Join Date
    Jun 2002
    Location
    'down under'
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, .. the link you gave was a 404, dunno where it was headed anyways, .. and back to your question..


    The way I understand it, when I define the cell size formatting of td cells I should use an inline style and when I format the text within it I should use the external correct?

    It all depends on what you're doing and how you're doing it. If you are using the td cell more than once, then I would apply it in a external style, and reference back to it when needed. the only things I code inline for css, is the "exceptions" in that I mean if I have the font arial, and I need something veranda for one cell, then applying that style for that one occasion inline would be the best option, because placing the style inline overrides the external styling. As I said, it all has to do with what you're doing, external for the masses, inline for the exceptions, and if the exception carries more than a couple of changes, use an id. that's what it is for.

    Hope that helps.
    Robby aka D.C.

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Excellent Digital

    Couldn't have explained it better yourself.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •