html - 如何正确定位我的 Logo ?

标签 html css

编辑: 聊天窗口应该右对齐,聊天区域在聊天窗口内,像这样,为什么不呢?:Codepen

应该是这样的: enter image description here


我想制作一个带有页眉和侧面矩形的简单网站。出于某种原因,我无法正确定位我的 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>

CodePen

我要实现的目标: enter image description here

(图中没有文字输入和发送按钮。)

最佳答案

看起来你需要添加一个宽度和高度:) 默认情况下,一个 div 的高度和宽度为零,因为里面没有任何东西你需要设置它!

关于html - 如何正确定位我的 Logo ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36314506/

相关文章:

html - IE9 : button exhibiting odd behavior and not working on first click, 仅在IE9中

css - 带字形图标的 Bootstrap 按钮

javascript - 获取动态表行的 URL

html - 我需要做什么才能将我的图像垂直对齐到 div?

html - 带有 html 格式页码的目录

javascript - 用户在文本框 (HTML) 中书写时的动态文本限制

html - 旁边有文字的可缩放图像

html - mozilla firefox 不支持输入文本框

html - 如何在 Laravel 中上传图片文件?

html - 填充:1% 等于 1% 主体宽度