• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

CSS Comments & Units

CSS Comments

Many times you may need to put additional comments in your style sheet blocks. So it is very easy to comment any part in style sheet. You simple put your comments inside /*… this is a comment in style sheet….. */

You can use /*….. */ to comment multi-line blocks in similar way you do in C and C++ programming languages.

Example

/* This is an external style sheet file */

h1,h2,h3 {

color: #36C;

font-weight : normal;

letter-spacing: .4em;

margin-bottom: lem;

text-transform: lowercase;

}

/* end of style rules, */

 

CSS Units

Before we start actual exercise, I would like to give a brief  idea about the CSS measurement units.

CSS supports a number of measurements including absolute units such as inches, centimeters, points, and so on, as well as relative measures such as percentages and em units. You need these values while specifying various measurements in your style rules e.g border = “1px solid red”

we have listed out all the CSS measurement units along with proper Examples

 

Unit Description Example
% Defines a measurement as a percentage relative to another value, typically an enclosing element p{font-size:16pt;line-height:125%}
cm Defines a measurement in centimeters div {margin-bottom:2cm}
Em A relative measurement for the height of a font in em spaces. Because an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each “em” unit would be 12pt; thus, 2em would be 24pt p{letter-spacing:7em;}
Ex This value defines a measurement relative to a font’s X-height. The x-height is determined by the height of the font’s lowercase letter X. p{font-size:24pt;line-height:3ex;}
In Defines a measurement in inches. P{word-spacing: 15in;}
mm Defines a measurement in millimeter p{word-spacing:15mm;}
pc Defines a measurement in picas, A pica is equivalent to 12 points; thus there are 6 picas per inch p{font-size:20c;}
pt Defines a measurement in points. A point is defined as 1/72nd of an inch body{font-size:18pt;}
px Defines a measurement in screen pixels. p{padding:25px;}

 

Summary
Review Date
Reviewed Item
CSS Comments & Units
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on CSS Comments & Units"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.