Wordpress - Removing default styles

2020-03-26 04:39发布

I'm trying to create my own Wordpress theme just for a one page, secured form. This form looks as it should normally, as you can see in this screenshot -->

Unfortunately, even though I've included my own reset.css file, WordPress is inheriting styles from the theme's style.css file. See here --> enter image description here

As you can see, the font size is much smaller, input fields aren't getting proper padding, the body background is supposed to be blue but is a grayish color in the second screenshot, fields aren't getting proper margins etc.

I know everyone is going to be asking for code, but before I do that, I'm just wondering if there is a default css file you can delete or modify that most of these styles would be included on. I'm guessing this might be included in the admin bar that gives default margin to the top?

If I need to add code, please just let me know and I will. I'm just assuming there are some wordpress gurus out there who already know the answer to this question.

Thank you

2条回答
对你真心纯属浪费
2楼-- · 2020-03-26 05:12

You should be able to just delete the content below the theme info in the style.css file in wordpress and it will completely axe all of wordpress default styles.

https://codex.wordpress.org/Finding_Your_CSS_Styles

查看更多
该账号已被封号
3楼-- · 2020-03-26 05:24

Here are some options:

  • Go to /wp-content/themes/YOUR-THEME/header.php and remove any stylesheet includes.
  • Go to /wp-content/themes/YOUR-THEME/functions.php and remove any wp_enqueue_style()
  • Make sure the style isn't generated by a plugin. If it is, you can deregister the style. Here is a link explaining how: http://speakinginbytes.com/2012/09/disable-plugins-css-file/
  • Overwrite the styles using your own stylesheet. Make sure your stylesheet comes LAST. You can do this a few ways - I'd recommend using wp_enqueue_style() with a dependency on the offending stylesheet.
查看更多
登录 后发表回答