简体   繁体   中英

How can I write specific CSS for a specific page in word press?

I want to make differently stylized pages by wordpress.

I tried the Simple Custom CSS plugin. But it didn't work.

Option1: WordPress automatically adds a unique class to the <body> tag of each page, so you can target that class in your CSS. You can use the body_class() function to output the class in your theme's HTML, then use that class to target the specific page in your CSS.

Option2: If you're using a custom page template, WordPress will also add a class to the <body> tag that corresponds to the template name . You can use that class to target the specific page in your CSS.

Option3: WordPress also adds a class to the <body> tag that corresponds to the page ID . You can use that class to target the specific page in your CSS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM