css - H1标签和P标签在同一行?

标签 css

我正在尝试在结束 H1 标签之后的 P 标签内放置一些文本,如下所示:

标题 这是紧随其后的文字......

但我无法让它工作。我制作了此 CSS,但可能缺少某些内容?

CSS:

p.start {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    line-height: 28px;
    text-align: justify;
    display: inline;
}

h1.start {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    line-height: 28px;
    margin: 0;
    display: inline-block;
}

HTML:

<div id="containerIntro">
    <h1 class="start">Headline </h1>
    <p class="start">Text......</p>
</div>

最佳答案

所以如果你有:

<div id="containerIntro">
    <h1>Headline</h1>
    <p>And here the text right after...</p>
</div>

您的 CSS 必须如下所示:

#containerIntro h1,
#containerIntro p {
    display: inline;
    vertical-align: top;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    line-height: 28px;
}

参见 http://jsfiddle.net/F3Bcd/3/ .

关于css - H1标签和P标签在同一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10319483/

相关文章:

css - Internet Explorer 背景大小问题

css - 从一个部门访问其他 CSS 部门

javascript - 使用 Colorbox jquery 插件时,根据视口(viewport)自动调整 innerWidth 和 innerHeight 的大小

html - 彩色 DIV 元素末尾的形状

css - 在动态列表中设置分隔线的可见性

html - 使用 Bootstrap 垂直居中列内容 - 表格布局问题

html - 根据最下面的内容制作底部边框

html - 背景图像未显示在 jquery 移动页面中

javascript - jQuery msDropdown ie9 问题

javascript - 图标未右对齐