html - CSS/HTML - div 内的 div 放置不正确

标签 html css django

这是一张附加图片,为我的问题提供了一些背景信息。 http://imgur.com/bPYmAIF

我在设置 div 内的 div 样式时遇到问题。发生的情况是,当我双击该 div 中的文本时,您可以看到突出显示仅突出显示了 div 的一半。

我想做的第二件事是确保所见即所得编辑器和页眉 div 之间没有间距。

我正在使用 Django-ckeditor 作为文本编辑器。这是由 {{form}} 模板标签呈现的。 (显然我正在为这个应用程序使用 django 网络框架)。

这是我的 HTML:

<div class="hero clearfix">
<div class="title">
    <h2>{{subsection_title}}</h2>
</div>
<br>
<div class="subsection">
    <div class="subsection_header ">
        <h4 style="text-align:left">Something interesting.</h4>
    </div>
    <div class="subsection_body">
    <p>lol</p>
    </div>
</div>          

这是我的 CSS:

 .subsection {
    width:1000px;
    margin:auto;
}
.subsection_header {
    border:1px solid #ccc;
    padding-left:20px;
    padding-right:20px;
    overflow:auto;
    margin:0px;
}
.subsection_body {
    margin:0px;
}

.hero {
    width:1000px;
    margin:auto;
    text-align:center;
}

.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
    }

最佳答案

尝试这样的事情根据你的页面宽度是如何记得关闭结束标签

.

hero clearfix
{
   position:absolute;
   width:980px;
   margin-left:-490px;
   left:50%;
}

它可能对你有帮助。

关于html - CSS/HTML - div 内的 div 放置不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17419484/

相关文章:

javascript - 在使用提示请求用户输入之前加载 html。

html - 在 CSS 中或直接编写元素属性有什么区别?

javascript - 无法读取父元素的 NodeName

css - 求助css,让div默认为页面长度

css - objectBoundingBox 外的 SVG 动画不考虑溢出

django - 110 : Connection timed out (Nginx/Gunicorn)

django 覆盖模型 save() 方法

html - 找不到要删除它的 CSS 边距

javascript - 显示 :none does not seem to be working all html elements

django - 如何在 Django 模板中制作 "nested"翻译字符串?