Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other WordPress Newbie Question: Best Practice for HTML in Posts

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45889
    yeeyang
    Participant

    I’m still rather new to WordPress but wanted to ask a simple question that I can’t find on Google. When you’re building a post, how much HTML do you throw into a post? Do you give it structural divs around certain areas or do you stick with paragraphs? Do you give classes to those paragraphs in order to apply a certain style on them?

    How much is too much and what is the best practice? There are times when I feel I’m building out a mini web page within the site itself. Is that the ‘correct’ or ‘right’ way of doing it? Please share. Thanks!

    #140638
    eristic
    Participant

    Personally, I give as much leeway for styling as necessary. Wrapping each content part in html makes it easier to style. the_content outputs to p tags, so I usually don’t wrap it in additional p tags.

    Hope that helps!

    #140648
    Alen
    Participant

    Anything that is complex, if you break it down and work in small pieces, it becomes manageable. So yes you should be working on smaller pieces, essentially building up a puzzle.

    As for wrapping elements. Wrap them however you see fit. Divs are used to logically group elements, and they don’t represent anything really, they just help us group things. IMO classes should be applied to divs, and not paragraphs, unless you are trying to do something stylistically specific to it or if you are introducing some sort of JavaScript interaction.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Other’ is closed to new topics and replies.