我有以下使用预订引擎的html组件。设置组件父宽度并继承子项。有三个输入字段和一个按钮。问题是,在不同的屏幕分辨率下,搜索按钮被删除到下一行,或者更多的搜索选项与按钮重叠。 CSS如下。
.search-container{
height: 70px;
width: 846px;
position: absolute;
top:170px;
z-index: 1000;
margin: 0px 60px 0px 60px;
}
.outer-container{
width: 836px;
border-radius: 10px;
background-color: rgba(43, 51, 54, 0.91);
padding: 5px;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='rgba(43, 51, 54, 0.91)', endColorstr='rgba(43, 51, 54, 0.91)',GradientType=0 ); /* IE6-8 */
}
.inner-container{
border-radius: 6px;
width: 100%;
height: 100%;
background-color: rgba(68, 84, 99, 0.64);
box-shadow: 0px -1px 1px #75899B;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='rgba(52, 73, 94, 0.5)', endColorstr='rgba(52, 73, 94, 0.5)',GradientType=0 ); /* IE6-8 */
}
.search-form{
display: table;
padding: 8px;
}
.search-form input[type=text]{
height: 39px;
border: 1px solid #808080;
border-radius: 5px;
padding-left: 13px;
font-size: 18px;
display: table-cell;
margin-right: 20px;
}
.search-form input[type=text]::-ms-clear{
display:none;
}
.search-form .pax{
width: 116px;
}
.hotel-list{
height: 43px;
border-radius: 5px;
font-size: 18px;
margin-right: 4px;
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: "";
padding: 7px;
width: 183px;
}
.with-hotel-list{
margin-right: 5px !important;
width: 128px;
}
.with-hotel-list-cal-icon{
right: 9px !important;
}
.search-form input[type=button]{
width: 118px;
height: 39px;
border-radius: 5px;
margin-left: 64px;
outline: none;
box-shadow: inset 0px 1px 0px #FFF;
outline:none;
border: 1px solid #424040;
font-family: sagoe-ui-light;
font-size:24px;
color:white;
cursor:pointer;
background: #ec5143; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VjNTE0MyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNjNzNmMzEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ec5143 0%, #c73f31 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ec5143), color-stop(100%,#c73f31)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ec5143 0%,#c73f31 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ec5143 0%,#c73f31 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ec5143 0%,#c73f31 100%); /* IE10+ */
background: linear-gradient(to bottom, #ec5143 0%,#c73f31 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ec5143', endColorstr='#c73f31',GradientType=0 ); /* IE6-8 */
}
.search-form input[type=button]:hover{
transition: box-shadow 0.5s ease;
background: #ea877e; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VhODc3ZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNjNDRiNDIiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ea877e 0%, #c44b42 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ea877e), color-stop(100%,#c44b42)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ea877e 0%,#c44b42 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ea877e 0%,#c44b42 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ea877e 0%,#c44b42 100%); /* IE10+ */
background: linear-gradient(to bottom, #ea877e 0%,#c44b42 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ea877e', endColorstr='#c44b42',GradientType=0 ); /* IE6-8 */
box-shadow: 0px 0px 14px #C44B08;
}
.search-form input[type=text]:focus{
transition: outline 0.3s,box-shadow 0.3s;
box-shadow: 0px 0px 8px #23D9FC;
outline: #23D9FC;
}
.search-input-wrapper{
display: table-cell;
float: left;
}
.icon-wrapper{
position: relative;
}
.icon-wrapper .input-icon{
position: absolute;
top: 11px;
right: 27px;
cursor: pointer;
}
.icon-wrapper label{
position: absolute;
top: 8px;
font-size: 14px;
text-align: center;
left: 33px;
font-family: sagoe-ui-light;
font-weight: 400;
text-shadow: 0px 0px 0px #808080;
color: #B9B9B9;
}
.more-search{
position: absolute;
width: 55px;
text-align: center;
line-height: 11px;
color: #FFF;
top: 18px;
text-decoration: underline;
font-size: 10px;
letter-spacing: 1px;
margin-left: 2px;
cursor: pointer;
font-family: 'sagoe-ui-light';
right: 155px;
}
.more-search:hover{
text-shadow: 0px 0px 15px #23D9FC;
transition: text-shadow 0.3s ease;
}
.search-pax{
background-image:url("../images/pax.png");
width: 28px;
height: 17px;
top:13px !important;
cursor: auto;
}
要解决上述问题,我必须手动配置保留在按钮上的边距。如何解决此问题以在不同的屏幕分辨率下以相同的方式生效?
答案 0 :(得分:0)
这个问题似乎与Firefox隔离开来,而且我所知道的与解决方案无关(我的测试可以在Chrome和IE9中使用)。
Firefox有很多无效和IE特定的CSS似乎无法处理好。
然而,布局问题的来源似乎是
@-moz-document url-prefix() {
.search-form input[type="button"] { margin-left: 117px; r}
}
您只为Firefox申请保证金。删除它将修复搜索按钮的包装。
第二个问题是Firefox中表单的宽度不同,导致了更多的搜索选项"定位不正确。对此的快速和肮脏的修复是使用与上面相同的hack来改变该元素的位置。
E.g。
@-moz-document url-prefix() {
.more-search {right: 190px;}
}
不是一个理想的解决方案,但如果您需要时间紧迫并且需要快速解决问题,那么在不对CSS和HTML进行更彻底的清理的情况下,这可能是您最好的选择。