简体   繁体   English

CSS3边框半径

[英]CSS3 Border Radius

http://codepen.io/ZacharyKearns/pen/pgzRmP?editors=010 http://codepen.io/ZacharyKearns/pen/pgzRmP?editors=010

I am making a calculator with with js and css and the main div that holds the calculator body has rounded edges 我正在用js和css制作一个计算器,并且拥有计算器主体的主要div都有圆角

#calc {
  background-color: #4CADEC;
  border-radius: 3%;
  height: 500px;
  margin: 200px 300px 400px 225px;
  width: 400px;
}

I am trying to overlay the main body with a different background color for the screen part of the calculator 我试图用计算器的屏幕部分的不同背景色覆盖主体

#top {
  background-color: #808080;
  border-radius: 15% 15% 0% 0%;
}

The problem is that because the top element is smaller the corners curve at a shallower angle than the calc div element 问题在于,由于top元素比calc div元素更浅,因此角线曲线的角度更浅

Can you simply use absolute units? 您可以简单地使用绝对单位吗?

#calc {
  border-radius: 15px;
}

#top {
  border-radius: 15px;
}

http://codepen.io/anon/pen/XXrPJE?editors=010 http://codepen.io/anon/pen/XXrPJE?editors=010

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

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