18

Possible Duplicate:
What does this CSS font shorthand syntax mean?

Recently while checking apple's website's styling, I came across this CSS rule declaration which I could not understand:

body {
   font: 12px/18px "Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana,sans-serif;
}

I could not understand, and thus wanted to know that how does the forward slash in font: 12px/18px actually work?

Community
  • 1
  • 1
Peeyush Kushwaha
  • 3,453
  • 8
  • 35
  • 69
  • 8
    @SvenBieder What would you suggest to google? I googled 'forward slash in css' and this question was first on google. – Eric Francis Oct 05 '15 at 19:04
  • 1
    @EricFrancis While the question was clearly asked and answered before, it is expressed more clearly here. Webnet's earlier question is not badly written. It is narrowly written, and so omits several terms and phrases that have allowed this question to rank more highly--or at all--in search results. A Google search circa 2017 confirms that we are better off with Peeyush having asked this question. – Christopher Harwood Mar 24 '17 at 13:22
  • It's alright, that's how SO's system is designed. They don't close off duplicates for exactly this reason, so that different ways in which the same question can be asked can point to the correct answer – Peeyush Kushwaha Mar 24 '17 at 13:37

3 Answers3

20

It simply means font-size and line-height

font: 12px/18px /*12px font-size and 18px line-height*/

That's a short-hand notation...There are many more in CSS which you can use, for example

margin-top: 10px;
margin-right: 20px;
margin-bottom: 30px;
margin-left: 40px;

Can be simply written as

margin: 10px 20px 30px 40px
         ^----^----^----^
       Top/Right/Bottom/Left

Or say for example this

border-width: 1px;
border-style:solid;
border-color: #ff0000;

Can be written as

border: 1px solid #f0000;

Here's a cool list of CSS shorthand.

hb20007
  • 515
  • 1
  • 9
  • 23
Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
1

It's shorthand for font-size: 12px; line-height: 18px.

Ulrich Schwarz
  • 7,598
  • 1
  • 36
  • 48
-1

Its a short cut for setting 2 css properties and does the same as the following:

font-size: 12px;
line-height: 18px;
Adam
  • 1,214
  • 13
  • 23