CSS Height and Width

The height and width properties are used to set height and width.

CSS Height and Width Syntax

div {
height: 60px;
width: 100%;


<!DOCTYPE html>
	div {
	  height: 60px;
	  width: 100%;
	  border: 1px solid red;
	<h2>CSS height and width properties</h2>
	<div>This element has a height of 50 pixels and a width of 100%.</div>

Click on the "Run This Code" button to see how it works.


Welcome CSS Syntax CSS Selectors CSS ADD css CSS Borders CSS Backgrounds CSS Colors CSS Padding CSS Margin CSS Fonts CSS Text CSS Outline CSS Box-Model CSS Height&Width CSS Icons CSS Links CSS Lists CSS Display CSS Tables CSS Position CSS Overflow CSS Align CSS Float CSS Inline-block CSS Opacity CSS Image-Gallery CSS Navigation Bar CSS Dropdowns CSS Cursors CSS Forms CSS Pseudo-classes CSS Pseudo-elements


CSS Gradients CSS shadows CSS 2D Transforms CSS 3D Transforms CSS Animations CSS Media Queries CSS Flexbox CSS important CSS Units