本文主要是介绍前端css溢出属性overflow,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
overflow: visible;默认是显示溢出
overflow:hidden;溢出隐藏
overflow: scroll; 出现滚动条,就算内容不超过盒子都显示滚动条
overflow: auto;内容多了自动出现滚动条
overflow: inherit;继承父元素效果
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>div{width: 200px;height: 200px;background-color: yellow;/* overflow: visible;默认是显示溢出 *//* overflow:hidden;溢出隐藏 *//* overflow: scroll; 出现滚动条,就算内容不超过盒子都显示滚动条*//* overflow: auto;内容多了自动出现滚动条 *//* overflow: inherit;继承父元素效果 */}.box{overflow-x: auto;overflow-y: hidden;/* 单独对于每个轴进行隐藏 */}</style>
</head>
<body><div>lorem ipsum dolor sit amet consectetur, adipisicing elit. Cum porro quod id, fuga placeat inventore atque. Molestiae sequi quidem quod laboriosam fugit, dolorem sit ad laborum iure incidunt libero dicta!lorem ipsum dolor sit amet consectetur, adipisicing elit. Cum porro quod id, fuga placeat inventore atque. Molestiae sequi quidem quod laboriosam fugit, dolorem sit ad laborum iure incidunt libero dicta!</div><div class="box"><img src="/css/7.盒子模型/big.png" alt=""></div>
</body>
</html>
这篇关于前端css溢出属性overflow的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!