Suscriber with us



Receive HTML?

Syndicate

CSS Dimension PDF Print E-mail

The CSS dimension properties allow you to control the height and width of an element. It also allows you to increase the space between two lines.

CSS Dimension Properties

The CSS dimension properties allow you to control the height and width of an element. It also allows you to increase the space between two lines.

How to set the height of an element using a pixel value?

<!-- created by phpguru.biz -->

img.normal
{
height: auto
}

img.big
{
height: 150px
}

img.small
{
height: 30px
}
<!-- created by phpguru.biz -->

How to set the width of an element using a percent value?

<!-- created by phpguru.biz -->
img
{
width: 60%
}
<!-- created by phpguru.biz -->

How to set the maximum height of an element?

<!-- created by phpguru.biz -->
p
{
max-height: 20px
}
<!-- created by phpguru.biz -->

How to set the minimum width of an element using a pixel value?

<!-- created by phpguru.biz -->
p
{
min-width: 1100px
}
<!-- created by phpguru.biz -->
 

How to specify the space between the lines in a paragraph using a number value?

<!-- created by phpguru.biz -->
p.small
{
line-height: 0.5
}
p.big
{
line-height: 2
}

<p class="small">
This is a paragraph with a smaller line-height.
This is a paragraph with a smaller line-height.
This is a paragraph with a smaller line-height.
This is a paragraph with a smaller line-height.
</p>

<p class="big">
This is a paragraph with a bigger line-height.
This is a paragraph with a bigger line-height.
This is a paragraph with a bigger line-height.
This is a paragraph with a bigger line-height.
</p>
<!-- created by phpguru.biz -->

Browser support: IE: Internet Explorer, F: Firefox, N: Netscape.

PHPGURU: The number in the "PHPGURU" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2).

PropertyDescriptionValuesIEFNPHPGURU

 height

Sets the height of an element

auto
length %

 4

 1

 6

 1

line-height

Sets the distance between lines

normal
numberlength %


max-height

Sets the maximum height of an element

none
length %


max-width

Sets the maximum width of an element

none
length %

 min-height

Sets the minimum height of an element

length
%

 min-width

Sets the minimum width of an element

length
%

2

 width

Sets the width of an element

auto
% length  

141

Examples

Set the height of an image using a pixel value
This example demonstrates how to set the height of an element using a pixel value.

Set the height of an image using percent
This example demonstrates how to set the height of an element using a percent value.

Set the width of an element using a pixel value
This example demonstrates how to set the width of an element using a pixel value.

Set the width of an element using percent
This example demonstrates how to set the width of an element using a percent value.

Set the maximum height of an element
This example demonstrates how to set the maximum height of an element.

Set the maximum width of an element using a pixel value
This example demonstrates how to set the maximum width of an element using a pixel value.

Set the maximum width of an element using percent
This example demonstrates how to set the maximum width of an element using a percent value.

Set the minimum height of an element
This example demonstrates how to set the minimum height of an element.

Set the minimum width of an element using a pixel value
This example demonstrates how to set the minimum width of an element using a pixel value.

Set the minimum width of an element using percent
This example demonstrates how to set the minimum width of an element using a percent value.

Specify the space between lines using a percent value
This example demonstrates how to specify the space between the lines in a paragraph using a percent value.

Specify the space between lines using a pixel value
This example demonstrates how to specify the space between the lines in a paragraph using a pixel value.

Specify the space between lines using a number value
This example demonstrates how to specify the space between the lines in a paragraph using a number value.





Digg!Del.icio.us!Google!Live!Facebook!Slashdot!Technorati!StumbleUpon!Newsvine!Yahoo!Free social bookmarking plugins and extensions for Joomla! websites!
Last Updated ( Monday, 17 March 2008 )
 
< Prev

CSS Examples

Examples

Polls

Which is the best Scripting language?