Formatting the text in a table with CSS





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







6















I need some basic css help. I attempted to style the cells of a table using a css stylesheet, but its not working



The code of the table is:



<table> 
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
</table>


The only way I got the text to not go to browser defaults was to explicitly state it on every single cell, which seems like a waste of load time (as miniscule as it is). Is there a way to set the size of the text for the entire table? It's is all the same size.



I tried putting the table inside a <p> and then styling it using a CSS class, but it was not working. Not sure if it matters, but I am using XHTML 1.0.










share|improve this question




















  • 1





    Would this help you? td, td a { font-size:13px; }

    – henryaaron
    Feb 3 '12 at 20:55











  • Styles like this are supposed to inherit, so you should be able to put a style attribute in the table tag. jsfiddle Are you saying that doesn't work?

    – Mr Lister
    Feb 3 '12 at 21:00








  • 1





    What exactly isn't working?

    – j08691
    Feb 3 '12 at 21:12











  • @MrLister that was not working. Its working now though

    – Chris
    Feb 3 '12 at 22:08


















6















I need some basic css help. I attempted to style the cells of a table using a css stylesheet, but its not working



The code of the table is:



<table> 
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
</table>


The only way I got the text to not go to browser defaults was to explicitly state it on every single cell, which seems like a waste of load time (as miniscule as it is). Is there a way to set the size of the text for the entire table? It's is all the same size.



I tried putting the table inside a <p> and then styling it using a CSS class, but it was not working. Not sure if it matters, but I am using XHTML 1.0.










share|improve this question




















  • 1





    Would this help you? td, td a { font-size:13px; }

    – henryaaron
    Feb 3 '12 at 20:55











  • Styles like this are supposed to inherit, so you should be able to put a style attribute in the table tag. jsfiddle Are you saying that doesn't work?

    – Mr Lister
    Feb 3 '12 at 21:00








  • 1





    What exactly isn't working?

    – j08691
    Feb 3 '12 at 21:12











  • @MrLister that was not working. Its working now though

    – Chris
    Feb 3 '12 at 22:08














6












6








6








I need some basic css help. I attempted to style the cells of a table using a css stylesheet, but its not working



The code of the table is:



<table> 
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
</table>


The only way I got the text to not go to browser defaults was to explicitly state it on every single cell, which seems like a waste of load time (as miniscule as it is). Is there a way to set the size of the text for the entire table? It's is all the same size.



I tried putting the table inside a <p> and then styling it using a CSS class, but it was not working. Not sure if it matters, but I am using XHTML 1.0.










share|improve this question
















I need some basic css help. I attempted to style the cells of a table using a css stylesheet, but its not working



The code of the table is:



<table> 
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
<tr><td><p style="font-size:13px"><a href="mailto:XXX@XXX.XXX">XXX&nbsp;&nbsp;&nbsp;</a></p></td><td><p style="font-size:13px">XXXX&nbsp;&nbsp;&nbsp;</p></td><td><p style="font-size:13px">XXXXXXX </p></td></tr>
</table>


The only way I got the text to not go to browser defaults was to explicitly state it on every single cell, which seems like a waste of load time (as miniscule as it is). Is there a way to set the size of the text for the entire table? It's is all the same size.



I tried putting the table inside a <p> and then styling it using a CSS class, but it was not working. Not sure if it matters, but I am using XHTML 1.0.







html css html-table






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 22:24









Brian Tompsett - 汤莱恩

4,2521339103




4,2521339103










asked Feb 3 '12 at 20:52









ChrisChris

96331226




96331226








  • 1





    Would this help you? td, td a { font-size:13px; }

    – henryaaron
    Feb 3 '12 at 20:55











  • Styles like this are supposed to inherit, so you should be able to put a style attribute in the table tag. jsfiddle Are you saying that doesn't work?

    – Mr Lister
    Feb 3 '12 at 21:00








  • 1





    What exactly isn't working?

    – j08691
    Feb 3 '12 at 21:12











  • @MrLister that was not working. Its working now though

    – Chris
    Feb 3 '12 at 22:08














  • 1





    Would this help you? td, td a { font-size:13px; }

    – henryaaron
    Feb 3 '12 at 20:55











  • Styles like this are supposed to inherit, so you should be able to put a style attribute in the table tag. jsfiddle Are you saying that doesn't work?

    – Mr Lister
    Feb 3 '12 at 21:00








  • 1





    What exactly isn't working?

    – j08691
    Feb 3 '12 at 21:12











  • @MrLister that was not working. Its working now though

    – Chris
    Feb 3 '12 at 22:08








1




1





Would this help you? td, td a { font-size:13px; }

– henryaaron
Feb 3 '12 at 20:55





Would this help you? td, td a { font-size:13px; }

– henryaaron
Feb 3 '12 at 20:55













Styles like this are supposed to inherit, so you should be able to put a style attribute in the table tag. jsfiddle Are you saying that doesn't work?

– Mr Lister
Feb 3 '12 at 21:00







Styles like this are supposed to inherit, so you should be able to put a style attribute in the table tag. jsfiddle Are you saying that doesn't work?

– Mr Lister
Feb 3 '12 at 21:00






1




1





What exactly isn't working?

– j08691
Feb 3 '12 at 21:12





What exactly isn't working?

– j08691
Feb 3 '12 at 21:12













@MrLister that was not working. Its working now though

– Chris
Feb 3 '12 at 22:08





@MrLister that was not working. Its working now though

– Chris
Feb 3 '12 at 22:08












3 Answers
3






active

oldest

votes


















7














I would add the class to the table:



<table class='myFormat'><tr>....</tr></table>


Then:



table.myFormat tr td { font-size: 13px; }


Can you tell me what browsers this is in?






share|improve this answer
























  • Thanks, it works now.

    – Chris
    Feb 3 '12 at 22:09



















4














Have you tried:



td { font-size: 13px }


OR



td.myfontsize { font-size: 13px ; }


then using:



class="myfontsize" 


applied to your td tags?






share|improve this answer
























  • I'd prefer not to have to define every single row though...

    – Chris
    Feb 3 '12 at 22:08











  • Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

    – Kummer Wolfe
    Feb 3 '12 at 22:13





















-1














Change < table> to < table style="font-size: 13px;"> (without spaces). That should change all of the text inside of the table.



Otherwise you can just add a class or id to it.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9135315%2fformatting-the-text-in-a-table-with-css%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    I would add the class to the table:



    <table class='myFormat'><tr>....</tr></table>


    Then:



    table.myFormat tr td { font-size: 13px; }


    Can you tell me what browsers this is in?






    share|improve this answer
























    • Thanks, it works now.

      – Chris
      Feb 3 '12 at 22:09
















    7














    I would add the class to the table:



    <table class='myFormat'><tr>....</tr></table>


    Then:



    table.myFormat tr td { font-size: 13px; }


    Can you tell me what browsers this is in?






    share|improve this answer
























    • Thanks, it works now.

      – Chris
      Feb 3 '12 at 22:09














    7












    7








    7







    I would add the class to the table:



    <table class='myFormat'><tr>....</tr></table>


    Then:



    table.myFormat tr td { font-size: 13px; }


    Can you tell me what browsers this is in?






    share|improve this answer













    I would add the class to the table:



    <table class='myFormat'><tr>....</tr></table>


    Then:



    table.myFormat tr td { font-size: 13px; }


    Can you tell me what browsers this is in?







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 3 '12 at 21:05







    user1086498




















    • Thanks, it works now.

      – Chris
      Feb 3 '12 at 22:09



















    • Thanks, it works now.

      – Chris
      Feb 3 '12 at 22:09

















    Thanks, it works now.

    – Chris
    Feb 3 '12 at 22:09





    Thanks, it works now.

    – Chris
    Feb 3 '12 at 22:09













    4














    Have you tried:



    td { font-size: 13px }


    OR



    td.myfontsize { font-size: 13px ; }


    then using:



    class="myfontsize" 


    applied to your td tags?






    share|improve this answer
























    • I'd prefer not to have to define every single row though...

      – Chris
      Feb 3 '12 at 22:08











    • Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

      – Kummer Wolfe
      Feb 3 '12 at 22:13


















    4














    Have you tried:



    td { font-size: 13px }


    OR



    td.myfontsize { font-size: 13px ; }


    then using:



    class="myfontsize" 


    applied to your td tags?






    share|improve this answer
























    • I'd prefer not to have to define every single row though...

      – Chris
      Feb 3 '12 at 22:08











    • Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

      – Kummer Wolfe
      Feb 3 '12 at 22:13
















    4












    4








    4







    Have you tried:



    td { font-size: 13px }


    OR



    td.myfontsize { font-size: 13px ; }


    then using:



    class="myfontsize" 


    applied to your td tags?






    share|improve this answer













    Have you tried:



    td { font-size: 13px }


    OR



    td.myfontsize { font-size: 13px ; }


    then using:



    class="myfontsize" 


    applied to your td tags?







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 3 '12 at 21:01









    Kummer WolfeKummer Wolfe

    50329




    50329













    • I'd prefer not to have to define every single row though...

      – Chris
      Feb 3 '12 at 22:08











    • Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

      – Kummer Wolfe
      Feb 3 '12 at 22:13





















    • I'd prefer not to have to define every single row though...

      – Chris
      Feb 3 '12 at 22:08











    • Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

      – Kummer Wolfe
      Feb 3 '12 at 22:13



















    I'd prefer not to have to define every single row though...

    – Chris
    Feb 3 '12 at 22:08





    I'd prefer not to have to define every single row though...

    – Chris
    Feb 3 '12 at 22:08













    Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

    – Kummer Wolfe
    Feb 3 '12 at 22:13







    Well if you use something like: td { font-size: 13px } that would apply a blanket style to all cells in any table. However make sure that's what you want for the page.

    – Kummer Wolfe
    Feb 3 '12 at 22:13













    -1














    Change < table> to < table style="font-size: 13px;"> (without spaces). That should change all of the text inside of the table.



    Otherwise you can just add a class or id to it.






    share|improve this answer




























      -1














      Change < table> to < table style="font-size: 13px;"> (without spaces). That should change all of the text inside of the table.



      Otherwise you can just add a class or id to it.






      share|improve this answer


























        -1












        -1








        -1







        Change < table> to < table style="font-size: 13px;"> (without spaces). That should change all of the text inside of the table.



        Otherwise you can just add a class or id to it.






        share|improve this answer













        Change < table> to < table style="font-size: 13px;"> (without spaces). That should change all of the text inside of the table.



        Otherwise you can just add a class or id to it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 3 '12 at 21:25









        ZyteXZyteX

        1062412




        1062412






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9135315%2fformatting-the-text-in-a-table-with-css%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas