Skip to main content
CSS is fun and cool and I like it.

Measuring Image Widths in JavaScript (Carefully!)

Let’s say you want to find an <img /> on the page and find out how wide it is in JavaScript. Maybe you need to make some choices based on that width (or height, or both) You can definitely do that. The DOM will even give you a variety of dimensions to choose from depending on what you need. There is definitely a catch though.… Read article “Measuring Image Widths in JavaScript (Carefully!)”



The width property in CSS specifies the width of the element’s content area. This “content” area is the portion inside the padding, border, and margin of an element (the box model).

.wrap {
  width: 80%;

In the example above, elements that have a class name of .wrap will be 80% as wide as their parent element. The accepted values are any of the length values, in addition to some keywords we’ll cover later.

Width … Read article “width”