0

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

我有两个问题: 1. 当我将浏览器窗口缩小到足以看到滚动条时,我的三个下拉菜单消失了。2. 我试图让我的按钮居中(查找资源),但无法弄清楚。我尝试过自动调整左右边距,我尝试过文本对齐,但它弄乱了我的三个框(宽度为 200 像素)的位置。

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

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;}
4

2 回答 2

0

Your Dropdowns shouldn't stack as nothing is responsive in your site. If they have a set width like width: 800px; They should be fine. However make sure to have all your id's surrounded with a quote:

<div id=buttons-div> 

should be

<div id="buttons-div"> 

To Center your Resource Button:

.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;
}
于 2013-11-14T17:19:08.190 回答
0

演示

1)从更改#selectposition2 fixedabsolute

将您的按钮包装在一个容器中并给该容器text-align:center

HTML

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

CSS

#find-resources-container {
 text-align:center   
}
于 2013-11-14T17:28:49.010 回答