Вопрос

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?

Это было полезно?

Решение

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

Другие советы

Now define

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

Demo

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top