并排问题(Div side by side issue)
我的CSS有问题 - 我有两个div - “section1”和“section2”。 我希望它们并排显示,但它们正如图所示显示。 有谁知道如何并排显示它们?
<div id="section1"> <h1><London></h1> <p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants</p> </div> <div id="section2"> <h2><London></h2> <p1>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants</p> </div> </div> #section1 { float:center; padding:5px; background-color:lime; margin-left:20px; width:300px; } #section2 { float:right; background-color:lime; margin-left:10px; width:300px; }
I have an issue with my CSS - I am have two divs - "section1" and "section2". I want them to be displayed side by side but they are being displayed as seen in the picture. Does anyone know how to display them side by side?
<div id="section1"> <h1><London></h1> <p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants</p> </div> <div id="section2"> <h2><London></h2> <p1>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants</p> </div> </div> #section1 { float:center; padding:5px; background-color:lime; margin-left:20px; width:300px; } #section2 { float:right; background-color:lime; margin-left:10px; width:300px; }
原文:https://stackoverflow.com/questions/35977486
最满意答案
Google最近宣布设计支持库 ,并且它支持实施Collapsing Toolbar 。
除了固定视图外,您还可以使用
app:layout_collapseMode="parallax"
(以及可选的app:layout_collapseParallaxMultiplier="0.7"
来设置视差乘数),以实现视差滚动(在CollapsingToolbarLayout
中表示同级ImageView)例:
<android.support.design.widget.AppBarLayout android:layout_height="192dp" android:layout_width="match_parent"> <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <android.support.v7.widget.Toolbar android:layout_height="?attr/actionBarSize" android:layout_width="match_parent" app:layout_collapseMode="pin"/> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout>
Google has recently announced Design support library and with this it has support for implementing Collapsing Toolbar.
In addition to pinning a view, you can use
app:layout_collapseMode="parallax"
(and optionallyapp:layout_collapseParallaxMultiplier="0.7"
to set the parallax multiplier) to implement parallax scrolling (say of a sibling ImageView within theCollapsingToolbarLayout
)Example:
<android.support.design.widget.AppBarLayout android:layout_height="192dp" android:layout_width="match_parent"> <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <android.support.v7.widget.Toolbar android:layout_height="?attr/actionBarSize" android:layout_width="match_parent" app:layout_collapseMode="pin"/> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout>
相关问答
更多-
Google最近宣布设计支持库 ,并且它支持实施Collapsing Toolbar 。 除了固定视图外,您还可以使用app:layout_collapseMode="parallax" (以及可选的app:layout_collapseParallaxMultiplier="0.7"来设置视差乘数),以实现视差滚动(在CollapsingToolbarLayout中表示同级ImageView) 例:
纯CSS视差效果问题(Pure CSS Parallax effect issue)[2023-07-07]
我相信效果( parallax与否)不起作用的原因是因为你使用作为主元素。 可能它使用的某些属性对没有影响。 我假设我们正在谈论perspective和它的供应商前缀对应物。 显而易见的解决方法是使用作为主机,而不是 。 我试图使用你链接的网站上的一些样式和图像,但它看起来不太好。 你知道了。 I believe the reason the effect (parallax or not) does not work is because you used < ...我在这里更新您的小提琴https://jsfiddle.net/nmdd876c/2/ 一切安好。 我只清理你的HTML并纠正你的外部资源。