css 一切都在同一行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4934341/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
css everything on same line
提问by C..
I would like to know what is the easiest way to keep everything in the same line? all of my things are coming on top of each other
我想知道将所有内容保持在同一行的最简单方法是什么?我所有的东西都在彼此之上
I put my 5 images in the same div but they still came on top of each other
我将 5 个图像放在同一个 div 中,但它们仍然相互重叠
Thanks!
谢谢!
回答by Bazzz
put a div around "everything" that should be on one line and give that div the following css:
在“所有内容”周围放置一个 div,该 div 应该在一行上,并为该 div 提供以下 css:
everythingOnOneLine {
white-space: nowrap;
}
everythingOnOneLine * {
display: inline;
}
回答by Alain Pannetier
You probably mean
你可能是说
div img {
display:inline;
}
回答by Karel
You can set the float style of your images to left:
您可以将图像的浮动样式设置为左侧:
<img style="float:left" src="" />
回答by gearsdigital
If you set display: inline-block
you can use the best from inlinelevel and blocklevel elements.
如果你设置了,display: inline-block
你可以使用最好的 inlinelevel 和 blocklevel 元素。
This means: Everything in one line but with the possibility to set a width
or a height
. Works on all elements like list entries or div elements. Not only images.
这意味着:所有内容都在一行中,但可以设置 awidth
或 a height
。适用于所有元素,如列表条目或 div 元素。不仅仅是图像。