我是网页设计的新手,所以请帮助我。我正在尝试在网页上显示一个搜索框。在 100% 分辨率下它看起来不错。但是当我增加屏幕的分辨率时,它会改变它的原始位置和包含分心。这是我的搜索框的正常图像:
这是在我通过 ctrl++ 缩放屏幕之后:
1:http: //i.stack.imgur.com/KrexC.pngenter code here
这是我的搜索框的代码:
<!--start SearchBox section-->
<center>
<section id="searchbox"style="background:white">
<div class="container" style="margin-top:0px;">
<div class="row">
<div class="col-lg-12">
<form >
<center>
<div id="SearchBoxBorder" style="background:white;border:none;border-radius:5px;margin-top:20px;width:800px;">
<table id="mytable" >
<td style="width:300px;background:white;">
<center> <div class="form-group">
<input type="text" class="form-control" id="searchtopicTxt" placeholder="I am looking for">
</div></center>
</td>
<td style="width:50px ;text-align:right;background:white;"> <center><strong> in</strong></center> </td>
<td style="width:400px;background:white;">
<center>
<div class="input-group" style="position: relative;">
<input type="text" class="form-control" placeholder="this locality" id="searchLocalityTxt">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
id="dropdownBtn">Select<span class="caret"></span></button>
<!--City dropdown -->
<div class="SearchCities" id="dialog" title="Basic dialog" >
<div id="outer_div" style="">
<div id="innerLeft_div" style="">
<h5 id="impcities_h5" >Important Cities:</h5>
<div id="ill_div" >
<ul class="city" id="left1_ul" type="none";>
<li><a>Delhi</a></li>
<li><a>Agra</a></li>
<li><a>Shrinagar</a></li>
<li><a>Noida</a></li>
<li><a>Himachal</a></li>
<li><a>Patna</a></li>
<li><a>Chandigarth</a></li>
<li><a>Shimla</a></li>
</ul>
</div>
<div id="ilr_div" >
<ul class="city" id="left2_ul" type="none";>
<li><a>Jaipur</a></li>
<li><a>Uti</a></li>
<li><a>Punjab</a></li>
<li><a>Kashi</a></li>
<li><a>Ayodhya</a></li>
<li><a>Sikkim</a></li>
<li><a>Jabalpur</a></li>
<li><a>Banaras</a></li>
</ul>
</div>
</div><!--/innerLeft-->
<div id="innerRight_div" style="">
<a class="close" id="cross">×</a>
<h5 id="ss" style="margin-top:10px;">All Cities :</h5>
<!--Page1------------------------------------------------------------------->
<div n class="page1" id="irl_div" >
<ul class="city" id="left1_ul" type="none";>
<li><a>Delhi</a></li>
<li><a>Agra</a></li>
<li><a>Shrinagar</a></li>
<li><a>Noida</a></li>
<li><a>Himachal</a></li>
<li><a>Patna</a></li>
<li><a>Chandigarth</a></li>
<li><a>Shimla</a></li>
</ul>
</div>
<div class="page1" id="irm_div" >
<ul class="city" id="left1_ul" type="none";>
<li><a>Delhi</a></li>
<li><a>Agra</a></li>
<li><a>Shrinagar</a></li>
<li><a>Noida</a></li>
<li><a>Himachal</a></li>
<li><a>Patna</a></li>
<li><a>Chandigarth</a></li>
<li><a>Shimla</a></li>
</ul>
</div>
<div class="page1" id="irr_div" >
<ul class="city" id="left1_ul" type="none";>
<li><a>Delhi</a></li>
<li><a>Agra</a></li>
<li><a>Shrinagar</a></li>
<li><a>Noida</a></li>
<li><a>Himachal</a></li>
<li><a>Patna</a></li>
<li><a>Chandigarth</a></li>
<li><a>Shimla</a></li>
</ul>
</div>
<div class="clear">
<div class="right nextPre" id="jqPagination">
<span style="width:100px"><a id="prevMetroCities" title="Previous" class="prev">Previous</a></span>
<span style="width:100px"><a id="nextMetroCities" title="Next" class="next">Next</a></span>
</div>
</div>
</div><!--/innerRight-->
</div><!--/outer-->
</div><!--/SearchCities dropdown-->
</div><!-- /btn-group -->
<button type="button" class="btn btn-primary" id="searchBtn" ><i class="icon-search" style="font-size:20px"></i> Search</button>
</div><!-- /input-group -->
</center>
</td>
</table>
</center>
</form>
</div><!--/col-lg-12-->
</div><!--/row-->
</div><!--/end of container-->
</section>
</center>
<!--End of SearchBox section-->
以上搜索框的css:
table#mytable
{
width:100%;
}
strong { font-size:28px; margin:0px 20px 0 0px; height:30px; line-height:30px; color:#333333; }
.SearchCities {
position:absolute;
margin-top:1px;
top: 100%;
right:134px;
z-index:1;
}
#dropdownBtn{
background:white;border-top-width:5px;border-right-width:5px;border-bottom-width:5px;border-left-width:1px;border-color:#eee;height:42px;border-radius:0px;text-align:center;color:black; margin-right:20px;margin-top:2px;
}
#dropdownBtn:focus, #dropdownBtn:active {
outline: none;
}
#searchtopicTxt{
border-width:5px;background:white; margin-top:17px; margin-left:15px; margin-right:10px;width:300px;border-style:solid;border-width:5px;border-color:#eee;font-family:Arial,Helvetica,sans-serif;height:42px; font-size:18px;
}
#searchLocalityTxt{
border-width:5px;background:white; margin-top:2px; margin-left:10px; margin- right:20px;width:;font-size:18px;
border-style:solid;border-width:5px;border-color:#eee;font-family:Arial,Helvetica,sans-serif;height:42px;position:relative;
}
#searchBtn{
margin-right:20px;border-radius:0px;
}
此外,如果我在 1.mozila 和 2.chrome 中打开相同的页面,两者的输出是不同的。但我不希望它能够响应任何分辨率。如果有人建议我解决这个问题,那将非常有帮助。所以,请帮助我。提前谢谢你。