Using HTML and CSS in posts and pages

Well... This question might not really have one definite answer but I guess I'm just looking for some advice about which path to take.

When it comes to creating posts and pages, is it a good idea to basically create the layout with hand-coded html? I'm thinking that it's probably a silly question but my html is pretty rusty and undeveloped (as is most of my coding, sadly) and I was going to do some brushing up to start creating layouts on my posts and pages.

I know there are a lot of visual editors out there but I figure that I'm probably better off just handling the layout with hand-coded html in case of future plugin problems and simply for the fact that it's free and gaining html knowledge is probably more valuable than any plugin would ever be.

Is it "advisable" to have a lot of direct html coding in an individual page?

In addition to that, if individual pages do have cool html layouts and I want to style a particular container or text or something, is it a good idea to embed CSS directly into the coding?

Thanks!

  • Michelle Shull

    Hey there, James!

    You can absolutely use text view on any post or page to code it up in raw HTML, with some exceptions that WP will strip out. In general, I'd say it's better to use a template than to try to code each page individually, but it's totally possible.

    As for inline CSS, I'd definitely advise against it, not because it would harm anything, it's just not a good habit/best practice. Using a custom CSS tool, Jetpack comes with one; some themes include a CSS editor, or you can get a plugin, like this one: https://wordpress.org/plugins/simple-custom-css/ is going to be the better choice for:
    1. ease of use
    2. not having to repeat CSS you'll use on every page in the text output of every page
    C. It'll be much easier to keep track of all the CSS you've added.

    Hope this helps!

  • james

    Thanks!

    Getting into wordpress has been such a tremendous learning experience and the curve doesn't seem to get any less steep as every new thing learned seems to bring up more questions. It's definitely a rabbit hole! I'm now going down the road of custom page templates, as you recommended above.

    I'm having a hard time wrapping my brain around how they actually work and how they actually will affect the actual layout of pages but I'm sure I can figure it out. It seems that the theme I'm using isn't the easiest to customize as the actions in the page.php were buried deep down in a page-hooks.php. This is probably common, though. I, at least, got to the point where I copied the content in their page.php into my template file and called the action in a copy of the page-hooks.php file that I moved into my child theme! Now I can make a page that claims to be a template that is exactly the same as the default template!!! I guess you have to get excited about the little things.

    Thanks for your help!

    James

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.