标题几乎解释了它.我在可滚动的div中有几个复选框.但由于某些原因,'background-color'属性不起作用.虽然'margin-top'似乎确实有效......
让我困惑的是一个属性如何工作而另一个属性不能工作.它也不像div拥有它自己的一组背景颜色属性,可能会超过复选框属性.
无论如何,下面是我的HTML(由JSP生成):
<div class="listContainer">
<input type="checkbox" class="oddRow">item1<br/>
<input type="checkbox" class="evenRow">item2<br/>
<input type="checkbox" class="oddRow">item3<br/>
<input type="checkbox" class="evenRow">item4<br/>
...
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的CSS:
.listContainer {
border:2px solid #ccc;
width:340px;
height: 225px;
overflow-y: scroll;
margin-top: 20px;
padding-left: 10px;
}
.oddRow {
margin-top: 5px;
background-color: #ffffff;
}
.evenRow{
margin-top: 5px;
background-color: #9FFF9D;
}
Run Code Online (Sandbox Code Playgroud)
提前感谢任何可以指引我正确方向的人!
它有文字,图像,然后是复选框,
我想使用更好的图像进行检查,但无法找到更改已检查和未检查图像的方法
this.checkBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.Image = global::ClientExam.Properties.Resources.action32;
this.checkBox1.Location = new System.Drawing.Point(145, 140);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(273, 127);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "checkBox1";
this.checkBox1.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage;
this.checkBox1.UseVisualStyleBackColor = true;
Run Code Online (Sandbox Code Playgroud)
谁知道一个不要求我自己控制的人呢?