Canvas is stretched when using CSS but normal with “width” / “height” properties

I have 2 canvases, one uses HTML attributes width and height to size it, the other uses CSS: <canvas id=”compteur1″ width=”300″ height=”300″ onmousedown=”compteurClick(this.id);”></canvas> <canvas id=”compteur2″ style=”width: 300px; height: 300px;” onmousedown=”compteurClick(this.id);”></canvas> Compteur1 displays like it should, but not compteur2. The content is drawn using JavaScript on a 300×300 canvas. Why is there a display difference? 9 … Read more

CSS Input with width: 100% goes outside parent’s bound

I’m trying to make a login form with two input fields with an inset padding, but they end up exceeding the parent’s bounds. What’s causing this? JSFiddle snippet: http://jsfiddle.net/4x2KP/ #mainContainer { line-height: 20px; font-family: “Helvetica Neue”,Helvetica,Arial,sans-serif; background-color: rgba(0,50,94,0.2); margin: 20px auto; display: table; -moz-border-radius: 15px; border-style: solid; border-color: rgb(40, 40, 40); border-radius: 2px 5px 2px … Read more

CSS – why doesn’t percentage height work? [duplicate]

This question already has answers here: Percentage Height HTML 5/CSS (7 answers) Closed 5 years ago. How come a percentage value for height doesn’t work but a percentage value for width does? For example: <div id=”working”></div> <div id=”not-working”></div> #working{ width:80%; height:140px; background:orange; } #not-working{ width:80%; height:30%; background:green; } The width of #working ends up being … Read more

How to get the width and height of an android.widget.ImageView?

╔══════════════════════════════════════════════╗ ^ ║ ImageView ╔══════════════╗ ║ | ║ ║ ║ ║ | ║ ║ Actual image ║ ║ | ║ ║ ║ ║ |60px height of ImageView ║ ║ ║ ║ | ║ ║ ║ ║ | ║ ╚══════════════╝ ║ | ╚══════════════════════════════════════════════╝ <————————————————> 90px width of ImageView I have an image view with some default … Read more

Does height and width not apply to span?

Total noob question, but here. CSS .product__specfield_8_arrow { /*background-image:url(../../upload/orng_bg_arrow.png); background-repeat:no-repeat;*/ background-color:#fc0; width:50px !important; height:33px !important; border: 1px solid #dddddd; border-left:none; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-bottom-left-radius:0px; border-top-left-radius:0px; -moz-border-radius-bottomleft:0px; -moz-border-radius-topleft:0px; -webkit-border-bottom-left-radius:0px; -webkit-border-top-left-radius:0px; margin:0; padding:2px; cursor:pointer; }​​​ HTML <span class=”product__specfield_8_arrow”>&nbsp;</span>​ Fiddle Basically I’m trying to emulate a button, make a span (or something) look like a button next to … Read more