Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a div that can dynamically grow; but due to some of the elements being higher than what they are by having a position: relative; the div is a little taller than what it needs to be.

The elements can have multiple lines; so the height of the div is not-constant, but regardless of how many lines these elements are, there's always a little "overhang"/ blank space.

Is there any way I can reduce the height of a div by a fixed amount. I'm thinking along the lines of

100% of the div's height - 20px

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

Probably could with calc():

height: calc(100% - 20px);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...