如何将两个图像放置在一个div的对角
如您所见,我不是 CSS 专家,我需要一些帮助来了解如何使用两个图像制作这个 div,如下图所示
I am not a CSS guy as you can see and I need little help on how to make this div with two images, like the drawing below
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
托马斯是对的,但还有一个更好的解决方案:
在这种情况下,类比 ID 更有用。
Thomas is right but there's a even better solution:
class are more usefull than ID in this case.
您需要左右
浮动
图像。这是 CSS:
floats
需要设置显式宽度这是一个包含所有内容的 jsfiddle:
编辑:更新了 jsfiddle 以包含周围的
div
http://jsfiddle.net/RQp5Z/1/
You need to
float
the images right and left.Here is the CSS:
floats
need explicit widths setHere is a jsfiddle with it all:
EDIT: updated the jsfiddle to include a surrounding
div
http://jsfiddle.net/RQp5Z/1/
由于您不是 CSS 人员,因此创建此示例是为了帮助您了解
div
http://jsfiddle.net/hT9xV/9/Since you're not a css guy, just created this example to help you understand what's going on with the
div's
http://jsfiddle.net/hT9xV/9/使用下面所示的代码可以彼此相对地显示两个图像。该解决方案假设两个图像需要位于同一行。
Two images can be displayed opposite to each other using the code shown below. This solution assumes the need for both images to be on the same line.