我正在嘗試使用邊框半徑轉換一些div。 我幾乎得到它,但有時div的看起來像「蛋」哈哈 這是我的CSS:使用邊框半徑繪製圓圈
#div{ /*div central*/
position:absolute;
top:50%;
margin-top: -20%;
left:50%;
margin-left: -20%;
background: #00A8D9;
width: 40%;
height: 40%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
border:3px solid #000;
}
#divSupIzq,#divSupDer,#divInfIzq,#divInfDer{ /*DIVs: left-top , right-top, left-bottom, right-bottom*/
background: #ddd;
width: 20%;
height: 20%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
border:3px solid #fff;
position:absolute;
}
#divSupIzq{ /*Div left-top*/
top:15%;
left:10%;
}
#divSupDer{ /*Div right-top*/
top:15%;
right:10%;
}
#divInfIzq{ /*Div left-bottom*/
bottom:15%;
left:10%;
}
#divInfDer{ /*Div right-bottom*/
bottom:15%;
right:10%;
}
而在HTML中,我使用JavaScript/jQuery的,以改變每個格(在基本的文本內容div的:左上,右上,左下,右下,並在中央DIV號)上依賴於各格的大小:
$('#div').resize(function(height){
var fuente = $(this).height()/2;
var margen = (fuente/2)-5;
$('.contenido').css('font-size',fuente+'px');
$('.contenido').css('margin-top',margen+'px');
});
這是我在鍍鉻的波紋擴展怎麼看: https://www.dropbox.com/s/k71kz5lahfolw95/screen.JPG
你能幫我,爲了divs總是圈,而不是蛋? 在此先感謝,丹尼爾
你能做出的jsfiddle?而且由於你在任何地方都使用百分比,形狀可能會根據窗口大小而變化。 – dezman 2012-07-12 15:45:18
這是來自以上信息的[jsFiddle](http://jsfiddle.net/eC3jq/)。 – 2012-07-12 15:47:49
是的,我需要使用百分比來適應不同的分辨率 – 2012-07-12 15:50:40