views:

24

answers:

2

when i write a paragraph i would like the text to look like this:

alt text

is it something that i have to do in css? i want similar formatting.

+4  A: 

You could do this by having a few different styles:

CSS:

 .level0 { font-weight: normal; }
 .level1 { font-weight: bold; }
 .level2 { font-weight: bold; font-size: 1.1em; }
 .level3 { font-weight: bold; font-size: 1.2em; }
 //etc...

Html:

<div>
  <a href="#" class="level0">Tag1</a> 
  <a href="#" class="level3">Tag2</a>
  //etc..
</div>

When you render the section out server-side, just plug in the appropriate level numbers to stick in your answers, e.g. top 3 get level10, next 3 get level9, and so on...just some algorithm looks good to you.

Nick Craver
Great answer Nick! +1
Doug Neiner
+2  A: 

For something like this, a minimum and maximum font-size is specified, then a range is associated with the terms (less important to most important). When the terms are written to the page, you combine the values to get the actual font size, somewhere between the minimum and maximum size.

The final output looks something like this:

<ul id='tags'>
   <li style="font-size: 12px"><a href="/tags/normal-term">Normal Term</a></li>
   <li style="font-size: 8px"><a href="/tags/small-term">Small Term</a></li>
   ....
</ul>

And then the CSS looks like this:

#tags { line-height: 16px /* Max font size */ }
#lags li { display: inline; margin-right: 10px}
Doug Neiner
i dont understand the point in specifying max and min if you are already specifying font size in the html
I__
@every_answer_gets_a_point The output looks like that, but I was assuming you were generating it on the server. If you are displaying a non-dynamic set of elements, use @Nick's solution and just use CSS. If you were dynamically generating it, the font size would be generated by your calculations on the server.
Doug Neiner
cool! how would i dynamically generate it?
I__
+1 Doug, @every_answer_gets_a_point - This alternative provides even more variability in sizing without a fixed number of levels in the CSS. Could be a much better solution, as always, just depends on your needs.
Nick Craver
@every_answer_gets_a_point What server language are you using?
Doug Neiner