I'm a software developer without very formal education in html/css design skills and I frequently find myself wrestling with how to choose to write my actual content after I get past the primary layout position.

The following is respective of html I would frequently work with

<div class="banding">
    <div class="col-half">
        <h2>Lorem ipsum dolor</h2>
        <div>
            <img src="../../small.png" />
        </div>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tempus, lorem non
            consectetur sagittis, ipsum sapien ultrices libero, et dapibus tellus diam pellentesque
            lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
            cubilia Curae; Maecenas blandit, neque at sodales hendrerit, nibh turpis tincidunt
            nulla, et sagittis urna massa pulvinar felis. Suspendisse eu augue elit, eget mollis
            sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vulputate
            lorem velit, sit amet suscipit ipsum.
        </p>
    </div>
    <div class="col-half"> ...
</div>

With the inner most elements losing all semblance of order and having h2 div and p all direct children of div.col-half.

Is there an actual best practices for arranging elements at this point?

I've tried a few various schemes and none seemed optimal such as each of those elements are always wrapped by a div, or instead of the div around the img that I use a p, same along the lines of the h2 tag whether it should be wrapped by a div or p etc.

  • Why do you want a <code>div</code> around your <code><img /></code>? David Jacobs almost 6 years ago
  • (More importantly, why can't I edit the mess that I just made with tags in that comment?) David Jacobs almost 6 years ago
  • comments can't be edited. This feature has been requested, you can help by voting it up: http://meta.doctype.com/forums/26218-general/suggestions/463438-allow-editing-comments?ref=title danwellman almost 6 years ago
  • @David Jacobs usually i've always found myself needing to position the image in some location, or for the blocks to be part of a grid system. Chris Marisic almost 6 years ago

2 answers

0
points
This was chosen as the best answer

Well apparently this forum is just useless.

Answered over 5 years ago by Chris Marisic
  • http://www.catb.org/~esr/faqs/smart-questions.html Tony Crockford over 5 years ago
danwellman 5600
3
points

Wrapping divs aren't necessarily required, unless specifically for styling purposes. Generally the only 'rule' is: use as few elements as possible to get the desired result and use the right elements for the job...

Answered almost 6 years ago by danwellman
  • Thanks for making the effort to add insight to this Chris Marisic over 5 years ago