简体   繁体   中英

How to use line-clamp with a input field

I'm trying to display text on 4 lines within an input field, but nothing seems to work. Does line-clamp work with input or it's just a p tags thing?

.line-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    overflow: hidden;
}

Edit: The user can write a note title in the input field and if the title is too long that's where the line-clamp should start working

Use textarea instead of input and limit the size by rows and cols attribute

<textarea rows="3" ></textarea>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM