简体   繁体   中英

How to change td,tr value in css?

I changed my code table to div tag its working well. Now I need to td,tr table value in css?

HTML code :

<TABLE class="table_value2">
    <TR>
        <TD>
            <FONT FACE="VERDANA" SIZE="1" COLOR="#000000">Logged in as:
                <B><?php echo $lms_username; ?></B>
        </TD>
    </TR>
    <?php if($lms_groups=="on" && $lms_user_group!="" ){ ?>
    <TR>
        <TD>
            <FONT FACE="VERDANA" SIZE="1" COLOR="#000000">
                <?php echo "$lms_gtitle: "; if($lms_groups=="on" ){echo "<B>$lms_user_group</B>";}?>
        </TD>
    </TR>
    <TR>
        <TD>
            <FONT FACE="VERDANA" SIZE="1" COLOR="#000000">
                <?php echo "$lms_sgtitle: "; if($lms_groups=="on" ){echo "<B>$lms_user_subgroup</B>";}?>
        </TD>
    </TR>
    <tr>
        <TD>
            <FONT FACE="VERDANA" SIZE="1" COLOR="#000000">
                <?php if($section=="reports" && $report){echo "<A HREF='index.php?section=reports&sid=$sid'>Back to Detailed Reports Section";}?>
            </FONT>
        </TD>
    </tr>
    <?php }?>
</TABLE>

CSS:

<style>
.table_value2, tr, td {
    size: 1;
    color: #000000;
    width: 100%;
}

<style>

But it is not working ? Can someone help me to solve this?

You have to end up your style with </style> . Not <style> . So just use </style> instead of <style> at the end.

Check out jsfiddle

Lots of issues and recommendations here.

  1. clean up the code. Use all small letters for html elements.
  2. the FONT thing is not easiest to manage. I'd use a simple div, then add style="" formatting for special fonts.
  3. The style comma thing places that style for each of the elements in your sheet, is that what you intended?
  4. Look at the jsfiddle... you have to style the FONT element to make this work

     .table_value2 TR TD FONT{ size: 1; color: red; width: 100%; } 

Try to use latest HTML/CSS. I tried to update few like this:

<table class="table_value2">
    <tr>
        <td>Logged in as: <span> Username </span>
        </td>
    </tr>
    <tr>
        <td>Lorem Ipsum</td>
    </tr>
    <tr>
        <td>Lorem Ipsum</td>
    </tr>
    <tr>
        <td>Lorem Ipsum</td>
    </tr>
</table>

CSS:

.table_value2, tr, td {
    size: 1;
    color: #000000;
    width: 100%;
    font-family:Verdana, Geneva, sans-serif;
}
.table_value2 td span {
    font-weight:bold;
}

Font tag not supported in HTML5 . Instead you can use the font-family for td directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM