![](/img/trans.png)
[英]Fixed height elements with flexible width to fit the text contents inside
[英]How to stop the text to change(flexible Padding) inside div while width and height are being decreased
我在另一個div中有一個div。 子div包含一些文本。 當我應用動畫時。 減小寬度和高度根據大小重置文本里面。 我知道為什么會發生這種情況,但我想停止更改文本的外觀。
function animation() { $(".outer").animate({ "width": "200px", "height": "300px" }); } animation();
div { width: 300px; height: 300px; } div > div { padding: 30px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="outer"> <div> Hello world Hello world hello world </div> </div>
在您的CSS中,嘗試添加min-width: 300px;
轉到div > div
選擇器。 由於要減少動畫的容器,因此可能要添加overflow: scroll;
在.outer
DIV上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.