这在所有其他浏览器中都可以正常工作但由于某种原因,当我在Opera中运行它时,整个app_cont div似乎在点击btn1时向左分流几个像素。我认为它与icon_div有关,因为当我删除它时它不会分流。图标div实际上是svg图像,但我已将其更改为div,因为我不知道如何将文件上传到SO。如果有人能向我解释我做错了什么,我会非常感激。
感谢。
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<style type="text/css">
@CHARSET "ISO-8859-1";
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}
body{line-height:1}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}
nav ul{list-style:none}
blockquote,q{quotes:none}
blockquote:before,blockquote:after,q:before,q:after{content:none}
a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent}
ins{background-color:#ff9;color:#000;text-decoration:none}
mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}
del{text-decoration:line-through}
abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}
table{border-collapse:collapse;border-spacing:0}
hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}
input,select{vertical-align:middle}
#app_cont {
border: 1px solid grey;
height: auto;
width: 500px;
margin: 200px auto;
background: #efefef;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
font-family: Arial;
padding: 10px
}
#ab_cont {
float: left;
height: auto;
width: 100%;
margin: 10px 0 0px 0;
}
#answerBox {
margin: 0px 10px 15px 0px;
padding: 5px 3px;
height: auto;
width: 225px;
padding: 5px 8px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border: 1px solid grey;
font-size: 30px;
float: left;
}
#prog_bar {
height: 20px;
border: 1px solid grey;
margin: 0px 10px 10px 0px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 3px;
background: #dfdfdf;
}
#prog_inner {
height: 20px;
-webkit-border-top-right-radius: 2px;
-webkit-border-bottom-right-radius: 2px;
-moz-border-radius-topright: 2px;
-moz-border-radius-bottomright: 2px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft: 4px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
background-color: #3299bb;
width: 15%;
}
#btn_cont {
border: 1px solid grey;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: #dcdcdc;
clear: both;
padding: 10px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#btn1 {
margin-left: 20px;
margin-right: 30px;
}
#btn3 {
margin-right: 20px;
margin-left: 30px;
}
#sub_btn {
font-size: 20px;
color: #545454;
border: 1px solid #545454;
height: 27px;
vertical-align: middle;
line-height: 27px;
height: auto;
margin: 0px 0px 15px 0px;
float: left;
}
.app_btns {
margin: 0;
font-size: 16px;
font-family: Arial;
font-weight: normal;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
border: 1px solid #ababab;
padding: 9px 18px;
text-decoration: none;
background: -webkit-gradient(linear, left top, left bottom, color-stop(5%, #ededed),
color-stop(100%, #dfdfdf) );
background: -moz-linear-gradient(center top, #ededed 5%, #dfdfdf 100%);
background: -ms-linear-gradient(top, #ededed 5%, #dfdfdf 100%);
filter: progid :
DXImageTransform.Microsoft.gradient (
startColorstr =
'#ededed', endColorstr =
'#dfdfdf' );
background-color: #ededed;
color: #777777;
display: inline-block;
text-decoration: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.app_btns:hover {
background: -webkit-gradient(linear, left top, left bottom, color-stop(5%, #dfdfdf),
color-stop(100%, #ededed) );
background: -moz-linear-gradient(center top, #dfdfdf 5%, #ededed 100%);
background: -ms-linear-gradient(top, #dfdfdf 5%, #ededed 100%);
filter: progid :
DXImageTransform.Microsoft.gradient (
startColorstr =
'#dfdfdf', endColorstr =
'#ededed' );
background-color: #dfdfdf;
cursor: pointer;
}
.app_btns:active {
position: relative;
top: 1px;
}
#hid_div {
border: 1px solid grey;
background: #f1e8ba;
width: 482px;
height: auto;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin: 0px 0px 10px 0px;
float: left;
display: none;
padding: 8px;
line-height: 20px;
font-size: 14px;
color: #313131;
}
#icon_div {
width: 125px;
height: 80px;
float: left;
margin: 0px 0px -12px 20px;
background:darkgrey;
}
#icon {
float: left;
height: 65px;
width: 65px;
margin: -8px 0px 0px 20px;
background:black;
}
#link {
text-decoration: none;
float: left;
/* float: right;*/ /* margin: -10px 0px 10px 0px;*/
margin: -16px 0px 0px 10px;
font-size: 12px;
color:#ff9900;
}
</style>
<title></title>
</head>
<body>
<div id="app_cont">
<div id="game_pnl">
<div id="prog_bar">
<div id="prog_inner"></div>
</div>
<div id="ab_cont">
<input type="text" name="answerBox" id="answerBox" autofocus="autofocus" autocomplete="off" maxlength="20" />
<a href="#" id="sub_btn" class="app_btns">Submit</a>
<div id="icon_div">
<div id="icon"></div>
<a href="#" id="link">link link link</a>
</div>
</div>
<div id="hid_div">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc bibendum tincidunt magna ut fermentum.
</div>
<div id="btn_cont" unselectable="on">
<a href="#" id="btn1" class="app_btns" unselectable="on">Button 1</a>
<a href="#" id="btn2" class="app_btns" unselectable="on">Button 2</a>
<a href="#" id="btn3" class="app_btns" unselectable="on">Button 3</a>
</div>
</div><!--#game_pnl-->
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script type="text/javascript" >
$(document).ready(function(){
$('#btn1').click(function(){
$('#hid_div').slideToggle(500);
});
});
</script>
</body>
</html>
这是JSfiddle,但你无法真正看到这个问题,因为这个问题似乎只出现在Opera中。