我的自制控制台出现问题。未按预期定位DIV
我有一张关于什么是错的图片。由于div的宽度,|
太远了。我不知道如何解决这个问题。 任何帮助表示赞赏。
我的代码:
HTML
<div class="container">
<div class="console">
<div class="console-body">
<div id="typer"></div><div id="typed-cursor">|</div>
</div>
</div>
</div>
CSS
body {
margin:0;
padding:0;
background-color:#262626;
}
.container {
max-width:800px;
margin-left:auto;
margin-right:auto;
}
.console {
position: fixed;
top: 50%;
left: 50%;
margin-top: -200px;
margin-left: -400px;
background-color:black;
width:800px;
height:400px;
border:solid 2px #444444;
overflow-y: auto;
}
.console #typer {
padding:0;
margin:0 0 0 5px;
color:#00FFFF;
display:inline-block;
}
#typed-cursor{
font-weight: 100;
display:inline-block;
}
有什么不对?
供参考:该网站是假的,用于教育目的。
网站链接在哪里? –
你能告诉我们在jsbin,jsfiddle或任何地方运行的代码吗?随着Inspector Element的浏览器将更容易帮助你! –
其实我试图回购你的问题,但不是。检查这[**小提琴**](http://jsfiddle.net/praveen_jegan/y4mMD/),也许一些其他的CSS可能会影响。 – Praveen