当前位置: 动力学知识库 > 问答 > 编程问答 >

html - Couple of bootstrap style questions

问题描述:

How to apply alternating color to bootstrap grid system

<body>

<div class="row">

<div class="col-md-4">

<label>Row1 Col-1</label>

</div>

<div class="col-md-4">

<label>Row1 Col-2</label>

</div>

<div class="col-md-4">

<label>Row1 Col-3</label>

</div>

</div>

<div class="row">

<div class="col-md-4">

<label>Row2 Col-1</label>

</div>

<div class="col-md-4">

<label>Row2 Col-2

</div>

<div class="col-md-4"></label>

<label>Row2 Col-3</label>

</div>

</div>

</body>

Apply Style site wide

I have include the bootstrap css in my project. Until I specify 'form-control' to input element the style is not working. How I force all the input elements in my site to inherit style 'form-control'

网友答案:

For your first question you can do this.

.row div:nth-child(even) {background: #CCC}
.row div:nth-child(odd) {background: #FFF}

For your second question you can copy the rules defined in the form-control class and override them into a separate css something like below.

input, select {
     RULES FROM FORM CONTROL
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: