Pages - পৃষ্ঠাসমূহ

color unit and length unit in html and css

Sometimes many user face trouble using the correct unit inhtml and css. Because there are more way to support this units. This post describe the foramat and the more ways of declaring units. And whats effetc and difference between units. This all units which are descbied, these is very necessary thing for html and css learners.

If you want to animated float menu you can learn this tutorial creating float menu using jquery
Hide Example Show Example

In this post we describe two things

Length unit
color unit

Length unit for css and html

What is the relation of difference of units and which units we use , when use. See tis chart and understant their effects and wahy and where these units used.

Length Unit

Units Description
% ( percentage )
in ( inch )
1 in = 2.54 cm
cm ( centimeter )
1 cm = 10 mm
mm ( milimeter )
em 1em = default font size
1em = 100% font size
ex One ex is the x-height of a font (x-height is usually about half the font-size)
pt ( point )
1 pt = 1/72 in
pc ( pica )
1 pc = 12 pt
px ( pixels )
a dot on the computer screen
1 em = default font size
suppose your default font-size is 12 px
2 em = 24 px
2em = 200%


After learning about the unit measurement we are ready to apply now.

Lets try these examp,e to understant.

In html Deafult font is :

                      Bangladesh is a wonderful country.



Now we use this measurement of various text and see the effects.
Units value Output
Percentage
font-size: 120%;
Bangladesh is a wonderful country
Inch
font-size: .6in;
Bangladesh is a wonderful country
Centimeter
font-size: .6cm;
Bangladesh is a wonderful country
Milimeter
font-size : 6mm;
Bangladesh is a wonderful country
em
font-size: 2em;
Bangladesh is a wonderful country
ex
font-size: 6ex;
Bangladesh is a wonderful country
Point
font-size: 30pt;
Bangladesh is a wonderful country
Pica
font-size: 1pc;
Bangladesh is a wonderful country
Pixel
font-size: 20px;
Bangladesh is a wonderful country


Color unit or color measurement in HTML & CSS

These part we will learn about the color unit in css and html.
There are two ways to measure the color. one is hexadecimal way and others is rgb value way.

These ways also use two ways. See below chart of syntax

Synatx Dsciption
#RRGGBB Standard Html 6 digit Hexadecimal RGB(Red-Green-Blue) value
#RGB Shorthand of RGB value
rgb(R,G,B) Each value conatains 0-255
R-(0-255)
G-(0-255)
B-(0-255)
rgb(R%,G%,B%) Each value conatains 0-100%
R-(0-100%)
G-(0-100%)
B-(0-100%)


Now see the effetcs of Html Color unit measurement Example

Synatx Output
#RRGGBB
background-color:#FF0000
color:#000000;
Bangladesh
#RGB
background-color:#FF0000
color:#000000;
Bangladesh
rgb(R,G,B)
background-color: rgb(255,0,0); color: rgb(255,255,255);
Bangladesh
rgb(R%,G%,B%)
background-color:rgb()
color:;
Bangladesh
Color Name
background-color: red
color: white;
Bangladesh

No comments:

Post a Comment