<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
我正在尝试弄清楚如何使用 css 将我的“文本”放在 Logo 旁边,请参见下面的屏幕截图。如何将文本“John Doe, DDS”放置在 Logo 旁边?请帮忙,我是 CSS 的新手。谢谢。
最佳答案
这不是很复杂。您可以在 Logo 和文本上使用 float: left;
。在它们周围制作一个 div
效果最好,所以你会得到这样的东西:
HTML
<div class='logo>
<img src='logo.png' />
</div>
<div class='text'>
<h1>JOHN DOE, DDS</h1>
</div>
CSS
.logo{
height: auto;
width: auto; /* makes the div same size as content */
float: left;
}
.text{
height: auto;
width: auto; /* makes the div same size as content */
float: left;
}
现在,如果您希望文本位于屏幕截图中的位置,您还可以将 top: something
添加到 .text
。
关于html - 在 Logo png 图像旁边放置文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37037333/