2014-01-11 26 views
0

在我們的網站上,有些客戶在登錄時會看到額外的文字。如果不是這位客戶,但css「隱藏」了這些差距,但差距仍在顯示。你可以在這裏看到登錄客戶的獨特css?

一個例子中的造型目前都顯示該塊是

.item { 
width:150px; 
margin-right:30px;  
height: 380px; 
position: relative; 
text-align: center; 
display: block; 
float: left; 

}

對於這些非客戶我想這是

.item { 
width:150px; 
margin-right:30px;  
height: 350px; 
position: relative; 
text-align: center; 
display: block; 
float: left; 

}

在另一個.cs文件中,這個代碼塊的價格是

// handle non-discounted customerLevel cases 
     if (ThisCustomer.CustomerLevelID == 0 || (ThisCustomer.LevelDiscountPct == 0 && extPrice  == 0)) 
     { 
      if (ThisCustomer.CustomerLevelID == 0 && AppLogic.AppConfigBool("WholesaleOnlySite")) // wholesale site with default customerLevel 
      { 
       results.Append(" "); 
      } 
      else // show Level 0 Pricing 
      { 
       if (salePrice == 0 || ThisCustomer.CustomerLevelID > 0) 
       { 
        results.Append("<span class=\"variantprice\">" + genericPriceLabel + regularPriceFormatted + "</span>"); 
       } 
       else 
       { 
        results.Append("<span class=\"RegularPrice\" >" + regularPriceLabel + regularPriceFormatted + "</span><br />"); 
        results.Append("<span class=\"SalePrice\" style=\"color: " + AppLogic.AppConfig("OnSaleForTextColor") + "\">" + salePriceLabel + discountedPriceFormatted + "</span>"); 
       } 

       results.Append("&nbsp;"); 

       results.Append(taxSuffix); 
      } 
     } 

有什麼辦法可以將css合併到cs文件中,這樣如果CustomerLevelID爲零,它將只顯示350px的高度?

回答

0

使用級聯:

.item { 
    width:150px; 
    margin-right:30px;  
    height: 350px; 
    position: relative; 
    text-align: center; 
    display: block; 
    float: left; 

} 
.loggedin .item { 
    height: 380px; 
} 
在生成代碼

然後渲染,如果有一個活動的登錄,就像<body class="loggedin">過程中添加類loggedinbody標籤。