- Create a new folder in the wp-content/themes directory with your theme’s name.
- Inside this folder, create a new file named style.css.
- Open the style.css file in a text editor.
- Add the following code to the top of the file to define the theme’s information:
vbnet
/*
Theme Name: My Theme
Theme URI: http://example.com/my-theme
Description: This is a description of my theme.
Author: My Name
Author URI: http://example.com
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: responsive-layout, custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/
- Replace the Theme Name, Theme URI, Description, Author, Author URI, and Version fields with your own information.
- Optionally, you can add additional tags to describe your theme’s features.
- Below the theme information, you can begin adding your CSS styles.
css
body {
background-color: #fff;
color: #333;
font-family: Arial, sans-serif;
}h1 {
font-size: 2em;
}
a {
color: #06c;
text-decoration: none;
}
- Save the style.css file and upload the entire theme folder to the wp-content/themes directory in your WordPress installation.
- Activate the theme in the Appearance section of the WordPress dashboard to see your styles in action.
That’s it! You’ve now created a style.css file for your WordPress theme. Remember to use proper CSS syntax and best practices when adding your styles to ensure your theme looks great and functions properly.