gpt4 book ai didi

javascript - css - 有没有办法让 div 与 h1(多行)在同一第二行?

转载 作者:行者123 更新时间:2023-11-28 02:59:54 25 4
gpt4 key购买 nike

我正在研究这个:

<h1><span>Test Heading This is text that I want to make appear to the right This is text that I want to make appear to the right This is text that I want</span></h1> 
<div>This is text that I want to make appear to the right of the heading and above the blue base line. This is text that I want to make appear to the right of the heading and above the blue base line. </div>

样式如下:

.bb {
border-bottom: 1px solid #999;
padding-bottom: 10px;
background-color: pink;
overflow: hidden;
}
h1 {
font-size: 1.3em;
font-family: calibri, arial;
margin-bottom: 5px;
float: left;
}
h1 span {
color: #fff;
background-color: #446688;
padding: 1px 5px 3px 5px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}

有没有办法让div和h1在同一第二行(多行)

https://jsfiddle.net/tarjoadi/w5q6qqLv/

这就是我想成为的人: screenshot

请帮忙。

谢谢

最佳答案

为了将两个文本 block 对齐在同一行上,您只需要将它们都设置为“内联”。为此,只需应用 css 样式:display: inline;

您还需要删除 float: left;,否则您可能得不到想要的结果。

h1 {
font-size: 1.3em;
color: #fff;
background-color: #446688;
/* float: left; */
}

/* New styles */
h1, div.inline {
display: inline !important;
}
<h1><span>Test Heading This is text</span></h1> 
<div class="inline">This is text that I want to make appear to the right of the heading</div>

关于javascript - css - 有没有办法让 div 与 h1(多行)在同一第二行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35120982/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com