0

so I'm working on wordpress list posts loop, and i put a post title in div with fixed width and height.. but some posts have a long title, so i want it to be in a smaller font size and less line height, but i can't make a new class for it,

here is what i mean:

<div class="post-title">hellow hellow hellow</div>
<div class="post-title-2">hellow hellow hellow hellow hellow</div>
<style>
.post-title{
width: 100px; height: 25px;
border:1px #000 solid;
font-size: 14px;
}
.post-title-2{
width: 100px; height: 25px;
border:1px #000 solid;
line-height:100%;
font-size: 11px;
}
</style>

and in JSFiddle:

http://jsfiddle.net/wLh3K/3/

is that possible? and how?

Ahmad Seraj
  • 171
  • 1
  • 8

2 Answers2

0

Now define

.container{
line-height:25px; // add this line 
height:25px;  // remove this line
}

Demo

Rohit Azad Malik
  • 31,410
  • 17
  • 69
  • 97
0

There is a jquery Plug-in ... You Can Use that.. Its flexible..Use this fittextjs

Tuhin
  • 3,335
  • 2
  • 16
  • 27