SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding a FONT to an ASP.net Table

    I am trying to make the whole table color="aqua".

    No matter where I put the FONT it gives me an error.

    Is there another way of writing the FONT to use in asp.net 2.0

    Code:
    <font color="aqua">
         <center><table border="1">
        	<tr><td>Text1/td>
                  <td>Text2</td>
                  <td>Text3</td></tr>
    	<tr><td>Text4</td>
                  <td>Text5</td>
                  <td>Text6</td></tr>
         </table></center>
    </font>

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    I know nothing about ASP.NET, but that looks like HTML to me?

    And what error are you getting?

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is in MySite.aspx

    <body id="Body1" runat="server">
    <form id="form1" runat="server">
    <div id = "heading">

    <font color="aqua">
    <center><table border="1">
    <tr><td>Text1/td>
    <td>Text2</td>
    <td>Text3</td></tr>
    <tr><td>Text4</td>
    <td>Text5</td>
    <td>Text6</td></tr>
    </table></center>
    </font>

    </div>
    </form>
    </body>
    Error code - Elements "Table" or "center" cannot be nested within element "font".

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,549
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Philosophaie View Post
    This is in MySite.aspx
    Error code - Elements "Table" or "center" cannot be nested within element "font".
    The font tag was deprecated years ago (in strict doctypes) and has no place in modern sites. It's an inline element anyway and cannot contain block elements.

    Remove the font tag and remove the center tag and apply a class to the table instead.
    e.g.
    Code:
    <body>
    <table class="my-table">
    		<tr>
    				<td>Text1</td> 
    				<td>Text2</td>
    				<td>Text3</td>
    		</tr>
    		<tr>
    				<td>Text4</td>
    				<td>Text5</td>
    				<td>Text6</td>
    		</tr>
    </table>

    Then add this css to your main css file:

    Code:
    .my-table{
    	margin:auto;
    	border:1px solid #000;
    	color:#0ff;
    }
    .my-table td{border:1px solid #000}
    Hope that helps.


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
  •