如何在HTML中将文本和图像彼此相邻放置? [英] How to place Text and an Image next to each other in HTML?
本文介绍了如何在HTML中将文本和图像彼此相邻放置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望文本和图像彼此相邻,但我希望图像位于屏幕的最左侧,而我希望文本位于屏幕的最右侧.这是我目前所拥有的....
I want the text and the image to be next to each other but I want the image to be on the far left of the screen and I want the text to be on the far right of the screen. This is what I currently have....
<body>
<img src="website_art.png" height= "75" width= "235"/>
<h3><font face="Verdana">The Art of Gaming</font></h3>
</body>
我该怎么做?
谢谢
推荐答案
img {
float:left;
}
h3 {
float:right;
}
jsFiddle example
请注意,您可能会希望对提供的代码后出现的所有元素使用样式clear:both
,以免它在浮动元素的正下方滑动.
Note that you will probably want to use the style clear:both
on whatever elements comes after the code you provided so that it doesn't slide up directly beneath the floated elements.
这篇关于如何在HTML中将文本和图像彼此相邻放置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文