2012-07-17 41 views
0

enter code here我確信CSS創建時只是爲了惹我。未將CSS值應用於表格行和標題

我有他在CSS文件如下:

.tabletop 
{ 
    padding: 0px; 
    margin: 0px; 
    border: none; 
    float: left; 
    width: 100%;  
} 

.tableth 
{ 
    height: 15px; 
    background: #eef3e2;  
} 

而這個視圖:

<table id="editorRows" class="tabletop" cellspacing="0"> 
     <tr>     
      <th class="tableth"> 
       <input id="ChkAll" type="checkbox" onclick="SetAllCheckBoxes(this)" />    
      </th> 

只表的格式被強制執行,而不是表標題元素。有任何想法嗎?

的要求整個CSS:

/* Edit Tables */ 
.tabletop 
{ 
    padding: 0px; 
    margin: 0px; 
    border: none; 
    float: left; 
    width: 100%;  
} 

.tableth 
{ 
    height: 15px; 
    background: #eef3e2;  
} 

body 
{ 
    margin: 0; 
    padding: 0; 
    border: 0; 
    width: 100%; 
    background: #fff; 
    min-width: 600px; 
    font: normal 12px/1.2em Verdana, Tahoma, Arial, Helvetica, Georgia, Sans-Serif; 
} 
a 
{ 
    color: #369; 
} 
a:hover 
{ 
    color: #fff; 
    background: #369; 
    text-decoration: none; 
} 
h1, h2, h3 
{ 
    margin: .8em 0 .2em 0; 
    padding: 5px, 2px, 5px, 2px; 
} 
h1 
{ 
    font-size: 12.3em; 
} 
h2 
{ 
    font-size: 1.2em; 
    color: #369; 
} 
h3 
{ 
    font-size: 1.1em; 
} 
h4 
{ 
    font-size: 1em; 
} 
p 
{ 
    margin: .4em 0 .8em 0; 
    padding: 0; 
} 
img 
{ 
    margin: 5px 0; 
} 

/*fdfcdc*/ 
table, th, td 
{ 
    border: none;  
} 



/* Header styles */ 
#header 
{ 
    clear: both; 
    float: left; 
    width: 100%; 
    border-bottom: 1px solid #000; 
    background-color: #cccccc; 
} 
#header p, #header h1, #header h2 
{ 
    padding: .4em 15px; 
    margin: 0; 
    line-height: 1.2em; 
} 
#header h1 
{ 
    font-size: 1.2em; 
} 
#header h2 
{ 
    font-size: 1.1em; 
} 
#header h3 
{ 
    font-size: 1em; 
    color: #fe7; 
} 

#navbar ul 
{ 
    clear: left; 
    float: left; 
    width: 100%; 
    list-style: none; 
    margin: 0; 
    padding: 0; 
} 

#navbar ul li 
{ 
    display: inline; 
    list-style: none; 
    margin: 0; 
    padding: 0; 
} 

#navbar ul li a 
{ 
    display: block; 
    float: left; 
    margin: 0 0 0 1px; 
    padding: 3px 10px; 
    text-align: center; 
    background: #eee; 
    color: #000; 
    text-decoration: none; 
    position: relative; 
    line-height: 1.3em; 
} 

#navbar ul li a:hover 
{ 
    background: #369; 
    color: #fff; 
} 
#navbar ul li a.active, navbar ul li a.active:hover 
{ 
    color: #fff; 
    background: #000; 
    font-weight: bold; 
} 
#navbar ul li a span 
{ 
    display: inline-block; 
    margin: 0; 
    padding: 10px 0; 
} 

#leftnavbar ul 
{ 
    clear: left; 
    float: left; 
    width: 100%; 
    list-style: none; 
    margin: 0; 
    padding: 0; 
} 

#leftnavbar ul li 
{ 
    display: inline; 
    list-style: none; 
    margin: 0; 
    padding: 0; 
} 

#leftnavbar ul li a 
{ 
    display: block; 
    float: left; 
    margin: 0 0 0 1px; 
    padding: 3px 10px; 
    text-align: center; 
    /*background: #eee;*/ 
    color: #000; 
    text-decoration: none; 
    position: relative; 
    line-height: 1.3em; 
} 

#leftnavbar ul li a:hover 
{ 
    background: #369; 
    color: #fff; 
} 
#leftnavbar ul li a.active, #leftnavbar ul li a.active:hover 
{ 
    color: #fff; 
    background: #000; 
    font-weight: bold; 
} 
#leftnavbar ul li a span 
{ 
    display: inline-block; 
    margin: 0; 
    padding: 10px 0; 
} 

#header img 
{ 
    padding-left: 10px; 
} 
/* The Real Status info sub menu */ 
#statusinfo 
{ 
    clear: both; 
    background: #eef3e2;  
    border-top: 3px solid #666; 
    margin: 0; 
    padding: 6px 15px !important; 
    text-align: right; 
} 

#logindisplay 
{ 
    clear: both; 
    background: #eef3e2;  
    border-top: 3px solid #666; 
    margin: 0; 
    padding: 6px 15px !important; 
    text-align: right; 
} 

.title 
{ 
    position: fixed; 
    left: 4px; 
    top: -1px; 
    float: left; 
} 

.title h2 
{ 
} 

/* keep label and input on same line 
.editor-label-same-line { 
    float: ; 
} 

.editor-field-same-line { 

} 

.editor-field-input-same-line { 

} */ 

/*border: 1px solid #C0C0C0; */ 





/* Top Menu */ 
.topmenu 
{ 
    float: right; 
    position: relative; 
} 

/* Left Menu */ 
.leftmenu 
{ 
    float: left; 
    vertical-align: top; 
} 
/* column container */ 
.colmask 
{ 
    position: relative; 
    clear: both; 
    float: left; 
    width: 100%; 
    overflow: hidden; /* This chops off any overhanging divs */ 
} 
/* common column settings */ 
.colright, .colmid, .colleft 
{ 
    /*float: left;*/ 
    /*width: 100%;*/ 
    position: relative; 
    overflow: hidden; 
} 

.col, .col2, .col3 
{ 
    position: relative; 
    padding: 0 3em 1em 0; 
    overflow: hidden; 
} 


.leftcol 
{ 
    float: left;   
    height: 95%; 
    width: 20%; 
    left: 2px;  
    color: Black; 
    padding: 2pc, 2pc, 2pc, 2pc; 
    background: #ffffff; 
} 

.rightcol 
{ 
    float: left; 
    height: 95%; 
    width: 76%; /*71*/ 
    left: 15px; 
    color: Black; 
    padding: 2pc, 3pc, 2pc, 5pc; 
    background: #ffffff;  
} 


.leftmenu h2 
{ 
    line-height:1.2em; 
    font-size: 1.1em; 
} 
.leftmenu h3 
{ 
    line-height:1.1em; 
    font-size: 1em; 
    color: #667; 
} 
.col2 ul 
{ 
    margin: 5px 0; 
    list-style: inside; 
    list-style-type: square; 
} 
.col2 ul li 
{ 
    margin-left: 15px; 
    padding: 0; 
} 
/* Form layout elements */ 
fieldset 
{ 
    margin: 1em 0; 
    padding: 1em; 
    border: 1px solid #CCC; 
} 

fieldset p 
{ 
    margin: 2px 12px 10px 10px; 
} 

fieldset label 
{ 
    display: block; 
} 

fieldset label.inline 
{ 
    display: inline; 
} 

legend 
{ 
    font-size: 1.1em; 
    font-weight: 600; 
    padding: 2px 4px 8px 4px; 
} 

input[type="text"] 
{ 
    width: 200px; 
    border: 1px solid #CCC; 
} 

input[type="password"] 
{ 
    width: 200px; 
    border: 1px solid #CCC; 
} 
/* Footer styles */ 
#footer 
{ 
    clear: both; 
    float: left; 
    width: 100%; 
    border-top: 1px solid #000; 
    border-bottom: 1px solid #000; 
    background-color: #fdfcdc; 
} 
#footer p 
{ 
    padding: 5px; 
    margin: 0; 
    position: relative;  
} 

編輯在_Layout.cshtml

CALLING的site.css
<title>@ViewBag.Title</title> 
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> 
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> 
+0

是應用背景顏色而不是高度?或者既沒有被應用? – Jrod 2012-07-17 01:48:37

+0

我在這裏看到你的例子的兩個屬性,嘗試檢查你的HTML代碼http://jsfiddle.net/luissanchezm86/QJmgd/ – Luis 2012-07-17 01:50:13

+0

顏色或高度應用 – 2012-07-17 01:54:37

回答

0

我感謝您的幫助和建議。我發現了兩件事來解決這個問題。請記住,我在IDE中以調試模式運行MVC應用程序......我忽略了在原始問題中陳述的內容。

儘管我在啓動MVC3應用程序之前更改(並保存了)Site.css文件,但在某些情況下,更改並不明顯,直到我刷新瀏覽器(F5)。在其他情況下,刷新似乎不起作用。所以在這些情況下,我使用任務管理器來殺死任何潛在的開發服務器實例並重新啓動程序。

0

我想,這可能是一點點幫助!正如你在下面的例子中看到的那樣,你使用的高度太小而看不出差異,這是因爲複選框的高度爲13px,幾乎與整個row15px

IMAGE

因此,CSS是越來越應用,你只需要設置的高度,有點 「higher」 想在這個EXAMPLE

UPDATE

這裏是更新http://jsfiddle.net/luissanchezm86/QJmgd/1/,但我仍然看不到錯誤!

希望這可以幫助你一點!

+0

在元素中直接設置樣式但在CSS中不能正常工作。表格中標題較大或使用更多屬性的問題相同。 – 2012-07-17 02:04:04

+0

你可以發佈你的整個** CSS **和** HTML **渲染? – Luis 2012-07-17 02:07:47

+0

我也沒有。我已經在幾個VS 2010 MVC3項目中看到了這一點。更改爲site.css「不佔用」。 – 2012-07-17 02:50:45