Drop Downs消失& amp;不能中心按钮

时间:2013-11-14 17:11:47

标签: html css center

我一开始就承认:这是我第一次尝试HTML / CSS编码。所以请原谅我代码的混乱。

我有两个问题:1。当我将浏览器窗口缩小到足以看到滚动条时,我的三个下拉菜单消失了。 2.我试图将我的按钮放在中心(查找资源),但无法弄明白。我尝试自动左右边距,我尝试了文本对齐,但它搞砸了我的三个盒子(宽度为200px)的位置。

感谢有人提供的任何帮助!

HTML:

<div id="resource-wrapper">

<div id="content">
    <p class="resource-p">Welcome to Our Resource Center.</p>
    <p class="resource-p">How may we help you?</p>
</div>

<div id=buttons-div>    
<div id=select>
    <select class="dropdown" name="field_related_brands_nid">
        <option value="All" selected="selected">Any</option>
        <option value="2511">Sample</option>
    </select>
    <select class="dropdown-2" name="field_related_technology_nid">
        <option value="All" selected="selected">Any</option>
        <option value="444">Sample</option>
    </select>
    <select class="dropdown-3" name="field_resource_type_value_many_to_one">
        <option value="All" selected="selected">Any</option>
        <option value="multimedia">Sample</option>
    </select>
</div>
<div id=buttons>    
    <img src="Images/Buttons1.jpg" class="resource-image">
    <img src="Images/Buttons2.jpg" class="resource-image">
    <img src="Images/buttons3.jpg" class="resource-image">
</div>
<button type="submit" class="resource-p1">Find Resources</button>
</div>

</div>

CSS:

#resource-wrapper {
width: 850px;
margin: 0 auto;}

#content {
background-color: #669bcf;
padding: 1px;
width: 100%;}

.resource-p {
text-align: center;
font-size: 30px;
font-family: sans-serif;
color: white;
line-height: 15px}

#buttons-div {
position: relative;
width: 850px;}

#select {
position: fixed;
margin-top: 214px;
width: 850px;}

.dropdown {
width: 160px;
margin-left: 78px;}

.dropdown-2 {
width: 125px;
margin-left: 115px;}

.dropdown-3 {
width: 95px;
margin-left: 148px;}

.resource-image {
margin: 50px 0 0 58px;}

.resource-p1 {
padding: 16px 18px 13px 18px;
margin: 20px;
text-align: center;
font-size: 21px;
font-family: sans-serif;
color: white;
font-weight: bold;
background-color: #669bcf;
border-style: solid;
border-width: 1px 1px 3px 1px;
border-color: #d7e4f4;
border-radius: 5px;}

2 个答案:

答案 0 :(得分:0)

您的下拉列表不应叠加,因为您的网站没有响应。如果它们的宽度设置如宽度:800px;他们应该没事。但是请务必将所有ID包围在引号中:

<div id=buttons-div> 

应该是

<div id="buttons-div"> 

将资源按钮居中:

.resource-p1 {
    margin: 12px auto;
    text-align: center;
    font-size: 21px;
    font-family: sans-serif;
    color: white;
    font-weight: bold;
    background-color: #669bcf;
    border-style: solid;
    border-width: 1px 1px 3px 1px;
    border-color: #d7e4f4;
    border-radius: 5px;
    display: block;
}

答案 1 :(得分:0)

DEMO

1)将#select的{​​{1}}从position更改为fixed

2)将您的按钮包裹在容器中,并为该容器absolute

<强> HTML

text-align:center

<强> CSS

<div id="find-resources-container">
            <button type="submit" class="resource-p1">Find Resources</button>
</div>