我正在编写一个顶部带有横幅的页面,该页面应包含一系列按钮。以下代码适用于所有按钮,但按钮应并排显示时换行。我知道 div 会自动换行,我应该使用 span,但是当我这样做时,它不会像使用 div 那样拉伸横幅以适应按钮。我尝试过使用多种浮点数,但无济于事。
<style type="text/css" media=screen>
body{
margin: 0px;
padding: 0px;
color: #000;
font-family: helvetica, times;
font-size: 14px;
}
#wrapper{
position: absolute;
height: 100%;
width: 100%;
text-align:center;
}
#banner{
background: url('images/banner_background.png');
position: relative;
margin: 0;
width: 100%;
color: #FFFFFF;
z-index: 3;
}
#banner #button {
padding:10px;
margin:auto;
position: relative;
background: url('images/button.png');
height: 100%;
z-index: 4;
width:100px;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="banner">
<div id="button">
dfsdfsfdsdfs
</div>
<div id="button">
sddfdfdsf
</div>
</div>
</div>