Tell a programmer to see the background of the front series of tutorials (56) - jQuery style control


Complete C language self-study manual (33)

Android multi-resolution framework for adaptation

JavaWeb core technology tutorial series

HTML5 front-end development combat tutorial series

MySQL database gymnastics tutorials (35 graphical version)

And overthrow their own past - Custom View tutorial series (10)

Thinking out of the woods, set foot on the road --Android develop sophisticated Advanced essence record

Android programmers looking to tell the front tutorial series (40 episodes free video tutorials + source code)


Copyright Notice

  • This article original author: Columbia Valley's younger brother
  • On the blog address: http: //blog.csdn.net/lfdfhl

Outline

In jQuery object can be called css () method to modify elements of the original style, the syntax is as follows:

jQuery对象.css({"属性1": "值1","属性2": "值2","属性3": "值3",....});

If only a single set attributes may be used to remove and which braces between the attributes and values ​​in a comma separated; syntax is as follows:

jQuery对象css("background-color","yellow");

Examples

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>jQuery样式控制</title>
		<!--引入jquery文件 -->
		<script src="js/jquery-1.11.3.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(function() {
				$("#author").css({"background-color":"yellow"});
				$("#blog").css("background-color","yellow");
				$("#welcome").css({"width": "400px","height": "200px","font-size": "60px","color": "green"});
			});
		</script>
	</head>
	<body>
		<h2 id="author" style="color: red;">本文作者:谷哥的小弟</h2>
		<h2 id="blog" style="color: red;">博客地址:http://blog.csdn.net/lfdfhl</h2>
		<div id="welcome">Hello jQuery</div>
	</body>
</html>

Here Insert Picture Description

Released 1022 original articles · won praise 1986 · Views 2.38 million +

Guess you like

Origin blog.csdn.net/lfdfhl/article/details/102658909