CSS Help

Discussion in 'CSS' started by thya, Oct 18, 2010.

  1. #1
    I have applied css style for a table by using below styles.
    
    .Wrapperdiv
    {
       text-align:center;
       width:100%;
       height:100%;
       
    }
    
    .Wrapperdiv Table /*Table*/
    {
        text-align:left;
        margin-left:auto;
        margin-right:auto;/*Center this table*/
        margin-top:15px;
    	border-right: #E3EDFA 1px solid;
    	border-top: #E3EDFA 1px solid;
    	border-left: #E3EDFA 1px solid;
    	border-bottom: #E3EDFA 1px solid;
    	 
    }
    
    
    .Wrapperdiv Table TH /*Table header*/
    {
    	border-right: #E3EDFA 1px solid;
    	border-top: #E3EDFA 1px solid;
    	border-left: #E3EDFA 1px solid;
    	border-bottom: #E3EDFA 1px solid;
    	font-size: 8pt;
    	background-image: url(tblhdrbg.gif);
    	background-repeat:repeat-x;
    	color: #0F4F7A;
    	font-weight:bold;
     
    	text-align:left;
    	font-family: Verdana, Tahoma;
    	height: 35px;
    }
     
    
    .Wrapperdiv Table td /*Table cells*/
    {
    	 
    	border-collapse:collapse;
    	vertical-align:middle;
    	height:25px;
    	margin:3px  2px 3px  8px;
     }
    
    <div class="Wrapperdiv">
    <table>
                <tr><th>header</th></tr>
                 <tr><td>cell 1</td></tr>
                 <tr><td>cell 2</td></tr>
     </table>
     </div>
    
    
    Code (markup):
    I have used this style in lot of pages. but the thing is, i dont want the style applied in some td tags . let's say, "Cell 2". how to exclude css style applying to some particular cell.

    Thanks in advance,
    Thya
     
    thya, Oct 18, 2010 IP
  2. GWiz

    GWiz Peon

    Messages:
    359
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can apply the opposite style to the cell you want. Create a class called .no-style and then apply the opposite style to it.

    So for example, this will be used by default:

    .Wrapperdiv Table TH /*Table header*/
    {
    border-right: #E3EDFA 1px solid;
    border-top: #E3EDFA 1px solid;
    border-left: #E3EDFA 1px solid;
    border-bottom: #E3EDFA 1px solid;
    font-size: 8pt;
    background-image: url(tblhdrbg.gif);
    background-repeat:repeat-x;
    color: #0F4F7A;
    font-weight:bold;

    text-align:left;
    font-family: Verdana, Tahoma;
    height: 35px;
    }

    But to remove the the borders and bg image you would do:

    .no-style {
    border:none;
    background:none;
    }


    BTW you can optmize your code.

    This can be written as: margin:15px auto 0;

    This can be written as border:1px solid #E3EDFA; (since you are using same thing for all sides)

    This can be written as background:url(tblhdrbg.gif) repeat-x;
     
    GWiz, Oct 18, 2010 IP
  3. thya

    thya Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot GWiz
     
    thya, Oct 18, 2010 IP