编辑: 聊天窗口应该右对齐,聊天区域在聊天窗口内,像这样,为什么不呢?:Codepen
我想制作一个带有页眉和侧面矩形的简单网站。出于某种原因,我无法正确定位我的 Logo !我目前拥有的:
html,
body {
background-color: #333;
margin: 0;
padding: 0;
}
#overlay {
position: absolute;
width: 100%;
height: 100%;
opacity: 0.2;
background: #ccc;
background: -webkit-linear-gradient(right top, #8900AB, #282828);
background: -o-linear-gradient(top right, #8900AB, #282828);
background: -moz-linear-gradient(top right, #8900AB, #282828);
background: linear-gradient(to top right, #8900AB, #282828);
}
#header {
position: absolute;
background: #404040;
width: 100%;
height: 10%;
}
#logo {
position: absolute;
background-image: url(http://csgovoid.net/img/logo.png);
background-repeat: no-repeat;
background-size: contain;
}
<html>
<body>
<div id="overlay"></div>
<div id="header">
<div id="logo"></div>
</div>
<div id="Seperator_H01"></div>
<div id="chat_extended">
<div id="chat_area"></div>
<input id="chat_input" type="text" placeholder="Chat...">
<button id="send_button" onClick="send()">SEND</buttton>
</div>
<div id="Seperator_V01"></div>
</body>
</html>
(图中没有文字输入和发送按钮。)
最佳答案
看起来你需要添加一个宽度和高度:) 默认情况下,一个 div 的高度和宽度为零,因为里面没有任何东西你需要设置它!
关于html - 如何正确定位我的 Logo ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36314506/