Support » Themes and Templates » Adjust excerpt length to certain height

  • Resolved Marijn


    Hi everyone,

    I’m searching for something that adjust the excerpt length till it reach a certain height. For example:
    height: 100px
    An excerpt with short words; a length of 50 words
    An excerpt with long words; a length of 30 words

    Both excerpts are 100px high. Can somebody help me with something like this? I can’t find anything how to make this.



Viewing 5 replies - 1 through 5 (of 5 total)
  • WPyogi


    Forum Moderator

    You may be able to do this in the CSS code — with the set height and ‘overflow: hidden;’

    What if you define a bigger excerpt length and put the text inside a div with overflow: hidden ?
    You could define a line-height for that div, and the height would be a multiplier of the line-height, so that a line of text wouldn’t appear in half.

    Just an ideia…

    same ideia wpyogi 🙂

    Sorry but I don’t think this is even possible, There are just way too many variables. For example, “it” is one word but so is “disestablishmentarianism”. 55 of the former take up far less space than 55 of the latter! Then, what font size is the user viewing the page at? Using what screen resolution or browser zoom level?

    I think your best bet is to have a fixed excerpt word length and then use overflow:hidden; in the CSS for the excerpt container. Providing any “read more” link is displayed outside the excerpt container, this should give you a decent display.

    Thanks for all your comments!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adjust excerpt length to certain height’ is closed to new replies.