CSS Help - Page 5 - Post ID 178526

User 371048 Photo


Registered User
59 posts

Inger, when placing text inside an element, is it best to place the text within the containing element, e.g.

<div id="text_box">
<div id="text_box_text">
Text Here
</div></div>

or is it better to keep them separate:

<div id="text_box"></div>
<div id="text_box_text">
Text Here
</div>

Still working on this: http://www.jayjaynet.com/jayjay/dev


Thank you.
-- me



User 122279 Photo


Senior Advisor
14,619 posts
Online Now

# 1 is too much unnecessary nesting of divs, and # 2 makes the first div redundant.

I would place text simply between <p></p> and then set some style on that paragraph. If you need to have different looking text somewhere, you can give the p tag a class. I have done that here:
http://www.johnsflats.com/b1.php .
Since I have other use for the p tag too, I have called the ones here p class="text", p class="german" and p class="bottomtext". I reuse those classes on nearly all the pages.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.