div个标签内的div个标签定位

div tags within a div tag positioning

几天以来,我尝试将 4 个 div 标签(住宿网站小部件)放置在一个 div 标签中,以便它们并排显示在一条水平线上。我使用 CSS 元素 "float" 和 "display" 来执行此操作,但无论出于何种原因,4 个 div 中只有 2 个按照我想要的方式定位。您可以在此处查看结果 http://www.somersetsights.co.za/preiseneu.html. The css style elements are either inline style in the html document or in the style sheet http://www.somersetsights.co.za/css/style.css

我不是专家。其实比较没经验。我努力自己解决这个问题,但我很挣扎。希望高手指点一下。谢谢

有很多方法可以解决这个问题。例如,您可以将 .services div 的宽度设置为 100%,这实际上是您想要内联的内容的父标记。我个人会使用 display: inline-block 来定位元素而不是浮动,但这取决于你。 此外,我会将 box-sizing: border-box 分配给 .services 标记,以避免 div 由于其填充而溢出。 希望对你有帮助。

希望对您有所帮助。将此 CSS 添加到外部 div

#review_widgets {
display: table-cell;
width: 1%;}

这将使您的 div 水平