Which is better to use re server side language? - <div> vs <ul> and <li>
I am designing an online mall and a website that offers free desktop background images. Some of the portions of my website will be dynamic (in that I will use server side language so that the background that will appear on the page will change depending on various factors). Should the dynamic portions of these pages be written using (i) <div> tags or (ii) <ul> and <li> tags? Or does it not matter?
For example, the below code will be dynamic, in that the (i) "Pamper Your Child", (ii) <img src="DELETE_temp images/babies-02.jpg" border="0" alt="" /> and (iii) "Gummy Lump</a></a></a> carries a variety of toys for children" will change depending on which settings the visitor to my website has chosen. Should the three <div> tags with the classes "mall_index_acc_hd1", "mall_index_acc_img" and "mall_index_acc_cont" be replaced with a <ul> and <il> tags?
<div class="mall_index_acc_hd1">Pamper Your Child</div>
<div class="mall_index_acc_img"><a href="#"><img src="DELETE_temp images/babies-02.jpg" border="0" alt="" /></a></div>
<div class="mall_index_acc_cont"><a href="http://www.gummylump.com/">Gummy Lump</a></a></a> carries a variety of toys for children. <span class="bold"><a href="http://www.gummylump.com/"> Shop now »</a></span></div>
Apologies if this question is in the wrong category and a bit general. I have limited knowledge of server side languages.
As far as PHP goes, it makes no difference -- it's just arbitrary text it needs to output. Base your decision on what makes the most semantic sense for the data being output -- and don't forget that <div> has less semantic meaning than, say, <p> or <h3> or <ul>/<li>. (My pet peeve is block-level tags wrapping a single block-level element, e.g. <div id="foo"><div class="bar"><p>text text text</p></div></div>, when you could just as accurately express that as <p id="foo" class="bar">text text text</p> -- both less typing and clearer semantics.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Just as an incidental mention too, make sure you're using the right quotes when outputting your data. As i'm assuming you're using echo and just populating the elements with the data values.
It's better explained here
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)