How Do I Add Additional CSS to WordPress?
Adding Additional CSS to WordPress
Adding additional CSS to WordPress is fairly easy. The most common way to do this is to add it to the theme’s style.
css file, but you can also add it to a custom plugin or theme file.
To add additional CSS to your WordPress theme or plugin, open the theme or plugin file in your text editor of choice and search for the line that specifies the theme’s style.css file location. Once you locate the line, add the following line of CSS to the file:
/* Add additional CSS here */
Note: If you’re adding additional CSS to a custom plugin or theme file, be sure to include the file name (minus the .php or .
zip extension) in the CSS declaration.
If you’re adding additional CSS to a theme or plugin file that’s not located in the theme or plugin’s directory, you’ll need to specify the full path to the file. For example, if your file is located at http://example.
com/my-theme/style.css, you would add the following line of CSS to your file:.
#my-theme .style-1 {
background-color: #f00;
}
If you’re adding additional CSS to a theme or plugin that’s located in the theme or plugin’s directory, you can simply include a reference to the file in your CSS declaration.
com/style.css, you could add the following line of CSS to your file:.
Note: If you’re adding additional CSS to a theme or plugin that’s located in the theme or plugin’s directory, be sure to include the file name (minus the .
Additional CSS declarations like the one above will be included in the theme or plugin’s compiled CSS file. If you’d like to include the additional CSS in the theme or plugin’s source code, you’ll need to include a link to the file in your CSS declaration.
For example, if your file is located at http://example.com/style.
#my-theme source code link {
font-size: 1.5em;
padding-left: 5px;
If you’re adding additional CSS to a plugin or theme that’s not located in the plugin or theme’s directory, you’ll need to include the path to the plugin or theme in your CSS declaration. For example, if your plugin or theme is located at http://example.com/my-plugin, you would add the following line of CSS to your file:
.my-plugin {
If you’re adding additional CSS to a plugin or theme that’s located in the plugin or theme’s directory, you can simply include a reference to the plugin or theme in your CSS declaration.com/my-plugin, you could add the following line of CSS to your file:
Note: If you’re adding additional CSS to a plugin or theme that’s located in the plugin or theme’s directory, be sure to include the file name (minus the .
If you’re adding additional CSS to a theme or plugin that’s not located in a text editor, you can use the wp_enqueue_style() function to add the CSS to the theme or plugin’s header.com/my-plugin, you could add the following line of code to your plugin or theme’s header:
wp_enqueue_style( ‘my-plugin’, get_template_directory_uri() . ‘/style.css’ );
Conclusion
Adding additional CSS to WordPress is fairly easy. If you’re adding additional CSS to a plugin or theme that’s located in the plugin or theme’s directory, you can simply.