简体   繁体   English

可能具有圆形/弯曲的侧面,而不是角落?

[英]Possible to have a rounded/curved side, not corners?

Trying to build something similar to the image below. 尝试构建类似于下图的内容。

The container would be 100% width, the header would be fixed height, but the body height would be dynamic. 容器的宽度为100%,标头的高度为固定高度,但主体高度为动态高度。

I was able to almost get what I want by doing the following to the "Body" div 通过对“ Body” div进行以下操作,我几乎可以得到想要的东西

border-radius: 50% 50% 0 0 / 15px 15px 0 0;
-moz-border-radius: 50% 50% 0 0 / 15px 15px 0 0;
-webkit-border-radius: 50% 50% 0 0 / 15px 15px 0 0;

Theoretically, I would like to have the "Header" div be curved, and the body go underneath, but I dont think that's possible (the header will contain a filled image) 从理论上讲,我希望“ Header” div弯曲,然后将主体放到下面,但是我认为这是不可能的(标题将包含一个填充的图像)

EDIT : forgot to mention. 编辑 :忘了提。 With the above code, and margin-top:-15px added to the bottom div, it did work in Firefox and IE, but not in Chrome and Safari. 使用上面的代码,并在底部div中添加margin-top:-15px ,它确实可以在Firefox和IE中工作,但不能在Chrome和Safari中工作。 Maps and sliders still went over to the Header div and did not get cut off. 地图和滑块仍移至Header div,并且没有被截断。

EDIT 2 http://jsfiddle.net/ShKNu/4/ 编辑2 http://jsfiddle.net/ShKNu/4/

^ This is how I currently have it. ^这就是我目前的情况。 As you can see, the map does not get cut off on the curve, and goes right into the header. 如您所见,地图不会在曲线上被切除,而是直接进入标题。

在此处输入图片说明

You were headed in the right direction 你朝着正确的方向前进

Putting the curve on the "body" or .main section with overflow: hidden and a negative margin-top is a good way to go. 将曲线放在“主体”或.main部分上时会产生overflow: hiddenmargin-top负值margin-top是一种不错的方法。 To resolve your issue with 3rd party content that is position: absolute , you just need to make sure your .main has position: relative . 要解决position: absolute为第三方的第三方问题,只需确保您的.main position: relative

Here is a fiddle with both positioned and non-positioned content inside .main (note: I tweaked the curve to be a bit more prominent for the demonstration). 这是一个.main包含定位和非定位内容的.main (请注意:我对曲线进行了调整,使其在演示中更加突出)。

It tests fine in IE9+, Chrome, and FF. 它可以在IE9 +,Chrome和FF中正常测试。 Obviously, any 3rd party content that is being placed in the header or elsewhere outside of .main will not necessarily be hidden, but that should be expected. 显然,放置在标头中或.main之外的其他任何第三方内容都不一定是隐藏的,但是应该可以预期的。 Yet even that can be worked around with proper positioning ( relative ) and z-indexing ( main higher than header ) set, as this fiddle shows. 然而,即使如此,也可以通过适当的定位( relative )和z-indexing( main高于header )设置来解决,如该小提琴所示。

尝试使用margin:-20px或其他度量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM