Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 1.74 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. draw circles using border radius
  2. #div{   /*div central*/
  3.     position:absolute;
  4.     top:50%;
  5.     margin-top: -20%;
  6.     left:50%;
  7.     margin-left: -20%;
  8.     background: #00A8D9;
  9.     width: 40%;
  10.     height: 40%;
  11.     -moz-border-radius: 50%;
  12.     -webkit-border-radius: 50%;
  13.     border-radius: 50%;
  14.     border:3px solid #000;
  15. }
  16. #divSupIzq,#divSupDer,#divInfIzq,#divInfDer{    /*DIVs: left-top , right-top, left-bottom, right-bottom*/
  17.     background: #ddd;
  18.     width: 20%;
  19.     height: 20%;
  20.     -moz-border-radius: 50%;
  21.     -webkit-border-radius: 50%;
  22.     border-radius: 50%;
  23.     border:3px solid #fff;
  24.     position:absolute;
  25. }
  26. #divSupIzq{  /*Div left-top*/
  27.     top:15%;
  28.     left:10%;
  29. }
  30. #divSupDer{ /*Div right-top*/
  31.     top:15%;
  32.     right:10%;
  33. }
  34. #divInfIzq{ /*Div left-bottom*/
  35.     bottom:15%;
  36.     left:10%;
  37. }
  38. #divInfDer{ /*Div right-bottom*/
  39.     bottom:15%;
  40.     right:10%;
  41. }
  42.        
  43. $('#div').resize(function(height){
  44.                     var fuente = $(this).height()/2;
  45.                     var margen = (fuente / 2)-5;
  46.                     $('.contenido').css('font-size',fuente+'px');
  47.                     $('.contenido').css('margin-top',margen+'px');  
  48.                 });
  49.        
  50. <div id="circle"></div>
  51.        
  52. #circle {
  53.     width: 100px;
  54.     height: 100px;
  55.     background: red;
  56.     -moz-border-radius: 50px;
  57.     -webkit-border-radius: 50px;
  58.     border-radius: 50px;
  59. }
  60.        
  61. $(window).resize(function(height) {
  62.     var div = $('#div');
  63.     var width = $('body').width() * 0.4;
  64.     var radius = width/2;
  65.     width += 'px';
  66.     radius += 'px';
  67.     div.css({
  68.         width: width, height: width,
  69.         '-moz-border-radius' : radius,
  70.         '-webkit-border-radius' : radius,
  71.         'border-radius' : radius
  72.     });
  73.  
  74.     // rest of your code for font-size setting etc..
  75. });
  76.  
  77. $(window).resize();