我有3个彼此相关的问题:
.wrapper {
margin: 0 auto;
width: 100%;
}
/* Change 960 to desired width */
.border {
border-style: double;
border-width: 10px;
background-color: silver;
overflow: expand;
}
.collapsible {
background-color: sliver;
color: black;
cursor: pointer;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active,
.collapsible:hover {
background-color: lightgray;
}
.collapsible:after {
content: "\002B";
background-color: sliver;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "\2212";
}
.content {
background-color: sliver;
padding: 0 18px;
max-height: 0;
transition: max-height 0.2s ease-out;
}
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap /3.4.0/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<div class="container">
<div class="border">
<button class="collapsible" data-toggle="collapse" data-target="#demo">
Simple collapsible
</button>
<div id="demo" class="collapse">
<div class="row" style="white-space:nowrap;">
<br />
<label style="margin-right:78px; margin-left:15px">Assign Date</label>
<label style="margin-right:78px;">Task Subject</label>
<label style="margin-right:78px;">Assigner</label>
<label style="margin-right:78px;">Pirorty</label>
<label style="margin-right:78px;">Status</label>
<label style="margin-right:78px;">Category</label>
<label style="margin-right:78px;">Due Date</label>
<label style="margin-right:78px;">Complete</label>
</div>
<div class="row" style="white-space:nowrap;">
<input
type="text"
name="AssignDate"
style="width:80px; margin-right:78px; margin-left:15px"
/>
<input
type="text"
name="TaskSubject"
style="margin-right:78px; width:85px"
/>
<input
type="text"
name="Assigner"
style="margin-right:50px; width:85px"
/>
<select name="Pirorty" style="width: 60px; margin-right:70px">
<option>High </option>
<option>Low</option>
<option>Normal</option>
</select>
<select name="Status" style="width: 100px; margin-right:20px">
<option>I</option>
<option>N</option>
<option>R</option>
<option>Re</option>
<option>Cancelled</option>
<option>Closed</option>
</select>
<select name="Category" style="width: 100px; margin-right:40px">
<option>A</option>
<option>D</option>
<option>E</option>
<option>INFO</option>
<option>I</option>
<option>M</option>
<option>N</option>
<option>R</option>
<option>S</option>
</select>
<input
type="date"
name="DueDate"
style="width: 80px; margin-right:60px"
/>
<select name="Category" style="width: 50px">
<option>10</option>
<option>20</option>
<option>30</option>
<option>40</option>
<option>50</option>
<option>60</option>
<option>70</option>
<option>80</option>
<option>90</option>
<option>100</option>
</select>
<br />
<br />
<input
type="checkbox"
name="IncludeTasksIWasCcedOn"
style="margin-left:15px"
/> Include Tasks I was CC'd On
<button type="submit" style="float :right; margin-right:15px">
Filter
</button>
<button type="reset" style="float :right; margin-right:15px">
Clear
</button>
<br />
<br />
<br />
</div>
</div>
</div>
</div>
答案 0 :(得分:1)
4)条子不是CSS的有效颜色。
3)您需要将类'in'添加到元素#demo中,以使其开始展开
2)您需要添加
#demo {
overflow: hidden;
}
到您的样式区域。这将隐藏任何会在元素高度小于其子元素高度时溢出的子元素
1)bg颜色介于两者之间的原因是因为您设置了父元素的背景色。除非覆盖,否则其bg颜色将流入子级。 我将父bg设置为白色,子bg颜色设置为银色。
<!DOCTYPE html>
<html>
<head>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"
>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
</script>
<style>
.wrapper {
margin: 0 auto;
width: 100%;
}
/* Change 960 to desired width */
.border {
border-style: double;
border-width: 10px;
/* changed bg color */
background-color: white;
/* expand is not a valid value
overflow: expand; */
}
.collapsible {
/* sliver is not a valid color */
background-color: sliver;
color: black;
cursor: pointer;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active,
.collapsible:hover {
background-color: lightgray;
}
.collapsible:after {
content: '\002B';
background-color: sliver;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "\2212";
}
.content {
background-color: sliver;
padding: 0 18px;
max-height: 0;
transition: max-height 0.2s ease-out;
}
#demo {
overflow: hidden;
}
/* added bg color here for inner area */
#demo .row {
background-color: silver;
}
</style>
</head>
<body>
<div class="container">
<div class="border">
<button
class="collapsible"
data-toggle="collapse"
data-target="#demo"
>Simple collapsible</button>
<div
id="demo"
class="collapse in"
>
<div style="clear:both;">
<div
class="row"
style="white-space:nowrap;"
>
<br />
<label style="margin-right:78px; margin-left:15px">Assign Date</label>
<label style="margin-right:78px;">Task Subject</label>
<label style="margin-right:78px;">Assigner</label>
<label style="margin-right:78px;">Pirorty</label>
<label style="margin-right:78px;">Status</label>
<label style="margin-right:78px;">Category</label>
<label style="margin-right:78px;">Due Date</label>
<label style="margin-right:78px;">Complete</label>
</div>
<div
class="row"
style="white-space:nowrap;"
>
<input
type="text"
name="AssignDate"
style="width:80px; margin-right:78px; margin-left:15px"
/>
<input
type="text"
name="TaskSubject"
style="margin-right:78px; width:85px"
/>
<input
type="text"
name="Assigner"
style="margin-right:50px; width:85px"
/>
<select
name="Pirorty"
style="width: 60px; margin-right:70px"
>
<option>High </option>
<option>Low</option>
<option>Normal</option>
</select>
<select
name="Status"
style="width: 100px; margin-right:20px"
>
<option>I</option>
<option>N</option>
<option>R</option>
<option>Re</option>
<option>Cancelled</option>
<option>Closed</option>
</select>
<select
name="Category"
style="width: 100px; margin-right:40px"
>
<option>A</option>
<option>D</option>
<option>E</option>
<option>INFO</option>
<option>I</option>
<option>M</option>
<option>N</option>
<option>R</option>
<option>S</option>
</select>
<input
type="date"
name="DueDate"
style="width: 80px; margin-right:60px"
/>
<select
name="Category"
style="width: 50px"
>
<option>10</option>
<option>20</option>
<option>30</option>
<option>40</option>
<option>50</option>
<option>60</option>
<option>70</option>
<option>80</option>
<option>90</option>
<option>100</option>
</select>
<br />
<br />
<input
type="checkbox"
name="IncludeTasksIWasCcedOn"
style="margin-left:15px"
> Include Tasks I was CC'd On
<button
type="submit"
style="float :right; margin-right:15px"
>Filter</button>
<button
type="reset"
style="float :right; margin-right:15px"
>Clear</button>
<br />
<br />
<br />
</div>
</div>
</div>
</div>
</body>
</html>