如何使用jqury修改css类属性? [英] how can modify css class property by using jqury?

查看:97
本文介绍了如何使用jqury修改css类属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何使用jqury修改css类属性?



我有css class,



 slider-content  
{
padding-left 0px !important ;
left 10%;
right 10%;
top 125px;
height 50px !important ;
width 100%!important ;
}





我想用jquery事件修改这个css类



谢谢。

解决方案

你不能修改类本身但你可以改变拥有该类的所有元素的css属性。



 


。slider-content) .each( function (){


this )。 css( padding-left 10px); // 为要更改的每个媒体资源执行此操作。
});


Hi,

how can modify css class property by using jqury?

I have css class,

.slider-content
            {
                padding-left: 0px !important;
                left: 10%;
                right: 10%;
                top: 125px;
                height: 50px !important;
                width:100% !important;
            }



I want to modify this css class using jquery event

Thanks.

解决方案

You can''t modify the class itself but you can change the css properties of all the elements that have that class.


(".slider-content").each(function(){


(this).css("padding-left", "10px"); //do this for each property you want to change. });


这篇关于如何使用jqury修改css类属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆