Home > Web Front-end > CSS Tutorial > How to write css style in jq

How to write css style in jq

醉折花枝作酒筹
Release: 2021-07-23 12:00:47
Original
2384 people have browsed it

The method is as follows: Generally, the style needs to be loaded when the page is initialized, so the ready() method is used, and the syntax format is "$(document).ready(function)". The ready event occurs when the DOM has loaded and the page (including images) has been fully rendered.

How to write css style in jq

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

The method of writing css style in jquery is as follows: Generally, the style must be loaded when the page is initialized, so use the ready() method

$(document).ready(function(){
	$("table tr td").css({
		"height":"25px",
	})
	$("span").css({
		"color":"#337ab7",
		"font-size":"13px",
	});
});
Copy after login

When the DOM (Document Object Model) has been loaded, and the page The ready event occurs when the object (including the image) has been fully rendered.

Since this event occurs after the document is ready, it is a good practice to place all other jQuery events and functions in this event. Just like in the example above.

ready() function specifies the code to be executed when the ready event occurs.

ready() function only works on the current document, so no selector is required.

The following three syntaxes are allowed:

Grammar 1

$(document).ready(function)
Copy after login

Grammar 2

$().ready(function)
Copy after login

Grammar 3

$(function)
Copy after login

Tip: ready( ) function should not be used with .

Recommended learning: css video tutorial

The above is the detailed content of How to write css style in jq. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template