我有一个关于制作按钮显示图像的问题例如,我有四个我想要的按钮每个按钮都在相同的图像内容中显示图像
换句话说:当您按下其中一个按钮时,您会看到图像
这是一个例子:https ://jsfiddle.net/i5yal/yvCtQ/1/
<div id="section-container">
<div class="section-img-container"><a>images will appear here</a>
</div>
</div>
<div id="section-button-container"><div>
<div class="section-button1"><a>1</a>
</div>
<div class="section-button2"><a>2</a>
</div>
<div class="section-button3"><a>3</a>
</div>
<div class="section-button4"><a>4</a>
</div>
</div>
</div>
CSS 代码:
#section-container {
background-color: #C0C0C0;
width: 300px;
height: 300px;
margin:0 auto;
}
#section-button-container {
width: 300px;
height: 30px;
margin:0 auto;
}
.section-button1 {
background-color: #808000;
width: 30px;
height: 30px;
float: left;
display: block;
margin-left: 30px;
margin-right: 20px;
}
.section-button2 {
background-color: #808000;
width: 30px;
height: 30px;
float: left;
display: block;
margin-left: 20px;
margin-right: 20px;
}
.section-button3 {
background-color: #808000;
width: 30px;
height: 30px;
float: left;
display: block;
margin-left: 20px;
margin-right: 20px;
}
.section-button4 {
background-color: #808000;
width: 30px;
height: 30px;
float: left;
display: block;
margin-left: 20px;
margin-right: 20px;
}
.section-img-container {
background-color: #008080;
background-position: center center;
width: 270px;
height: 270px;
margin: 0 auto;
}