我正在尝试<hx>在段落中添加标签,例如:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam pulvinar tincidunt neque, at blandit leo mattis vitae. Cras <h2>placerat</h2> justo vel risus porta cursus. Nullam eget sem nibh. Sed <h3>mattis</h3> facilisis rhoncus. Morbi sit amet nisl lectus.</p>
Run Code Online (Sandbox Code Playgroud)
但我总是在每一个之前得到换行符,甚至应用所有这些,以及以下声明的组合:
h1, h2, h3, h4, h5, h6 {
display:inline !important;
text-transform:none;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
clear:none;
color:inherit;
margin:0;
padding:0;
}
Run Code Online (Sandbox Code Playgroud)
那么我该怎样做才能使标签与文本内联不被注意?现在我得到类似的东西
Lorem ipsum dolor坐下来,精致的adipistur elit.Aliquam pulvinar tincidunt neque,at blandit leo mattis vitae.信用评级机构
placerat justo vel risus porta cursus.Nullam eget sem nibh.桑达
mattis facilisis rhoncus.Morbi坐在amet nisl lectus.
谢谢
PS:顺便说一下,我正在使用drupal的蓝图框架主题.
SLa*_*aks 28
你误用了标题标签.
您应该使用<span>带有CSS类的标签.
我试了一下,发生了什么事情,当Firefox看到<h1>里面有一个无效的标签时<p>,它会自动关闭<p>标签.你可以在Firebug中清楚地看到这一点.
小智 11
只需在段落的开头放置一个h2标签即可.例如.
<p>The p tags are automatically breaking as soon as the html parser reaches the hx tags. if you really want to do this you must close the p tag before the hx tag. then set p and hx to display inline!</p>是para,我们希望自动打破用h1标签封装..
<p><h2></h2>The p tags are <h1>automatically breaking</h1> as soon as the html parser reaches the hx tags. if you really want to do this you must close the p tag before the hx tag. then set p and hx to display inline!</p>
Run Code Online (Sandbox Code Playgroud)
但是当p标签自动断开时,我们无法实现我们给p标签的样式.
注意:h1标签的样式应为
h1{ display:inline; !important}
Run Code Online (Sandbox Code Playgroud)
该<p>标签只能包含内联元素.标题标记是块级元素,<p>即使您将它们设置为内联显示,也无法进入标记内部.
根据这种用法,它们在语义上是不正确的 - 段落不应该在它们内部随机浮动.考虑正确使用<em>和<strong>标记,或者如果它们确实不是您要描述的内容,请使用<span>具有特定类的标记.
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam
pulvinartincidunt neque, at blandit leo mattis vitae.
Cras <em>placerat</em> justo vel risus porta cursus. Nullam eget
sem nibh. Sed <strong>mattis</strong> facilisis rhoncus. Morbi sit
amet nisl lectus.</p>
Run Code Online (Sandbox Code Playgroud)