分两种情况:
一、在不使用css预处理器的情况下直接使用 >>> 即可:
举例:
<style scoped>
.html-content{
width: 100%;
min-height: 200px;
max-height: 300px;
overflow-y: auto;
>>> img{
width: 95%;
}
>>> p{
width: 98%;
word-wrap:break-word;
// overflow: hidden;
}
}
</style>
二、在使用css预处理器(scss/less/stylus等)的情况下使用 /deep/ 即可:
举例:
<style lang="scss" scoped>
.html-content{
width: 100%;
min-height: 200px;
max-height: 300px;
overflow-y: auto;
/deep/ img{
width: 95%;
}
/deep/ p{
width: 98%;
word-wrap:break-word;
// overflow: hidden;
}
}
</style>
三、不影响全局样式的情况下修改Element样式
举例:
// englist-table为自定义的class样式名(注意不能加scoped)
//
<style lang="sass">
.englist-table{
/deep/ .el-table__body-wrapper{
max-height: 500px;
overflow-y: auto;
}
}
</style>
网友评论