• 0

HTML Layout: Table vs DIV


Question

Okay, before you start yelling on how stupid it is to use a table for a layout, let me state that I know better.  (of at least I believe I do)

 

I have a simple situation where I need a "table" with 7 rows and 3 columns.  This will NEVER EVER EVER change (yea, I know, that's been said before) and while I have been looking for a more correct solution, eg: http://alistapart.com/article/holygrail  It's having some issues with what I want to do.

 

So, I thought I'd bring this up here so everyone can berate me and say how stupid the idea of using a simple table for a simple situation and maybe give some advice on a better solution that allows rows.  The above solution does not... and while I can work it out...  I thought I'd ask in case I'm missing something.

 

Have a great evening.

James

Link to comment
https://www.neowin.net/forum/topic/1211355-html-layout-table-vs-div/
Share on other sites

17 answers to this question

Recommended Posts

  • 0
<style>
	.tbl{width:100%;float:left;}
	.tblRow{width:100%;float:left;}
	.tblCell{width:33%;border:1px solid;float:left;}
</style>
<div class="tbl">
	<div class="tblRow">
		<div class="tblCell">
			COL1_ROW1
		</div>
		<div class="tblCell">
			COL2_ROW1
		</div>
		<div class="tblCell">
			COL3_ROW1
		</div>
	</div>
	<div class="tblRow">
		<div class="tblCell">
			COL1_ROW2
		</div>
		<div class="tblCell">
			COL2_ROW2
		</div>
		<div class="tblCell">
			COL3_ROW2
		</div>
	</div>
	<div class="tblRow">
		<div class="tblCell">
			COL1_ROW3
		</div>
		<div class="tblCell">
			COL2_ROW3
		</div>
		<div class="tblCell">
			COL3_ROW3
		</div>
	</div>
</div>

Here is a very basic example. Driven by CSS.

  • 0
  On 29/04/2014 at 21:33, Sikh said:

I think using tables for tabular data like you want is Ok. I think tables to construct a layout instead of a div is where the above harassment would come from

 

 

Sorry, I thought I was clearer... but obviously I was not.  The columns will hold a few images and some Range objects.  Not tab data....  hence the reason i am experiencing the doubt. 

 

My base issue is trying to avoid too many DIV tags to accomplish what I want, but I think I can create a simple DIV called "ROW" before each object...  I'm just checking to see if there are other thoughts.   Thanks again for your reply

  • 0

Tabular data could be images too. If your constructing a layout with them then no. But if your constructing a visual representation of data then your fine

So what I mean is overall website shouldn't be a table but you could have tables on an individual page. For example Wikipedia

  • 0
  On 29/04/2014 at 21:50, kkick said:
<style>
	.tbl{width:100%;float:left;}
	.tblRow{width:100%;float:left;}
	.tblCell{width:33%;border:1px solid;float:left;}
</style>
<div class="tbl">
	<div class="tblRow">
		<div class="tblCell">
			COL1_ROW1
		</div>
		<div class="tblCell">
			COL2_ROW1
		</div>
		<div class="tblCell">
			COL3_ROW1
		</div>
	</div>
	<div class="tblRow">
		<div class="tblCell">
			COL1_ROW2
		</div>
		<div class="tblCell">
			COL2_ROW2
		</div>
		<div class="tblCell">
			COL3_ROW2
		</div>
	</div>
	<div class="tblRow">
		<div class="tblCell">
			COL1_ROW3
		</div>
		<div class="tblCell">
			COL2_ROW3
		</div>
		<div class="tblCell">
			COL3_ROW3
		</div>
	</div>
</div>

Here is a very basic example. Driven by CSS.

 

 

Thanks Kristopher,  I was working on something that worked with the original post, but this is a much better answer.

  • 0
  On 29/07/2014 at 19:32, JoeFuture said:

Not to troll, but these forums use tables for layout.  Having tried to style forums for both desktop and mobile browsers responsively, I'm also leaning towards a table layout solution for coding simplicity.

That's because IPB was made that way to support older browsers better.

 

 

 And you guys are bumping a few months old thread btw...

  • 0
  On 07/08/2014 at 02:26, sushirox said:

I've using tables in email templates btw...  :)

Emails are a exception, most email clients have crap html support which makes the use of tables a must :/

  • 0
  On 29/07/2014 at 19:32, JoeFuture said:

Not to troll, but these forums use tables for layout.  Having tried to style forums for both desktop and mobile browsers responsively, I'm also leaning towards a table layout solution for coding simplicity.

 

Tables layout is awful for maintenance.

 

I've seen tables layout that was so totally ****** ** that it was almost impossible to maintaint without a wysiwyg editor.

 

css done right is far easier to maintain cause you'll have less tags. The content will be the focus.

 

Also tags semantic should not be ignored. A table is for tabular date.

  • 0
  On 29/07/2014 at 19:32, JoeFuture said:

Not to troll, but these forums use tables for layout.  Having tried to style forums for both desktop and mobile browsers responsively, I'm also leaning towards a table layout solution for coding simplicity.

 

There is no table tags on this forum..  Neowin uses div and css for layout.

  • 0
  On 07/08/2014 at 15:29, shozilla said:

There is no table tags on this forum..  Neowin uses div and css for layout.

Seems like it yeah, I thought IPB was still using tables :P

 

Though the comment inputbox is inside a table ;)

This topic is now closed to further replies.
  • Posts

    • Great write up. Microsoft had much from developers when it comes to new features and frameworks. That fortune seems only Apple appears to have. The day they announce new visuals or API’s, almost all developers jump immediately on implementing it when the first beta is out, so it can be released asap. And when a developer is slacking, Apple users actively call them out.
    • Tiles on 10 was great for touch devices, just few people use WIndwos devices in an actual Tablet way. Groove as GREAT it seamlessly pulled my music to stream from my OneDrive even on the mobile app. Legacy Edge was also great it was only failed because Google kept screwing with their sites to break them for non-Chromium browsers. Cortana also had great possibilities and was just never fully realized. Kind of like Siri. IMO they should have just revamped it to be what Copilot is.
    • Windows 11 gets file system fixes, printer improvements, and stability patches in KB5062663 by Taras Buria In addition to new non-security updates for Windows 10 and Windows 11 version 24H2, Microsoft released the so-called C-updates for those on Windows 11 version 23H2 or 22H2. KB5062663 (build numbers 22621.5699 and 22631.5699) is rolling out with some notable fixes and improvements for the file system, IME, networking, printer and stability improvements, and more. Here is the changelog: [Country and Operator Settings Asset (COSA)]​​​​​​​ Fixed: This update brings profiles up to date for certain mobile operators. [File systems] Fixed: This update addresses an issue in the Resilient File System (ReFS) where using backup applications on large files could occasionally result in system memory becoming fully exhausted. Fixed: An issue where searching for PDF files in a shared folder could return incorrect error messages—such as “No More Files” or “STATUS_NO_MORE_FILES.” These errors disrupted output to the virtual PDF printer and interfered with backup processes. [Input (known issue)] Fixed: An issue when using the Microsoft Changjie IME (input method editor) for Traditional Chinese might cause problems such as not being able to form or select words, unresponsive spacebar or blank key, incorrect word output, or a broken candidate window display. This can occur after installing KB5062552. Fixed: This update addresses an issue that affects Phonetic input methods, including the Hindi Phonetic Input keyboard and the Marathi Phonetic keyboard, which might not work correctly after installing KB5062552. [Networking] Fixed: An issue where peripheral devices could take longer to work after resuming from hibernation on some devices with active cellular connections. [Printer] Improved: Printer names now appear more clearly when using IPP Directed Discovery, making it easier to identify printers during setup. [Stability issue] Fixed: This update addresses an issue observed in rare cases after installing the May 2025 security update and subsequent updates causing devices to experience stability issues. Some devices became unresponsive and stopped responding in specific scenarios. [Taskbar] Fixed: This update addresses an issue where the taskbar icons for accessibility features are not appearing. You can get today's update in Settings > Windows Update. KB5062663 is optional, so feel free to skip it if you do not need anything from the changelog. Alternatively, download KB5062663 from the Microsoft Update Catalog.
    • AMD and Stability AI bring on-device Stable Diffusion 3 to Ryzen AI PCs by Pradeep Viswanathan AMD today announced its latest collaboration with Stability AI to introduce the world’s first block FP16 Stable Diffusion 3.0 Medium model. This new image generation model can generate significantly better quality images and is optimized to run on AMD Ryzen AI XDNA 2 NPUs. Amuse is an AI image generation app by Tensorstack for Windows PCs. You can now download the latest Amuse v3.1 on a Ryzen AI laptop that has an XDNA 2 NPU to enjoy the SD 3.0 Medium model. Since the model runs entirely on the laptop, you don't need to pay anything or even create an account to generate an image using AI. The Amuse app also allows you to apply custom AI filters to your photos and images. Recommended Specs to run the SD 3.0 model using Amuse: AMD Ryzen AI 300 series processors with 24GB of RAM or higher AMD Ryzen 8040 series processors (AMD XDNA Super Resolution requires the latest OEM MCDM and NPU driver update) with 32GB of RAM AMD and Stability AI have implemented several optimizations to make the SD 3.0 model run on Ryzen laptops. For example, they have reduced the memory requirements to make it run on 24GB laptops while consuming only 9GB of memory. Additionally, a 2-stage pipeline powered by the AMD XDNA 2 NPU increases the output 2MP (1024x1024) image to a 4MP resolution (2048x2048), making it more suitable for print scenarios. AMD has also provided some prompting tips and samples on its website to achieve better results with this Stable Diffusion 3.0 model; you can check it out here. The ability to run powerful image generation models locally on a laptop opens up new possibilities for creativity and workflow efficiency, without the constraints of cloud-based AI services.
  • Recent Achievements

    • Week One Done
      SmileWorks Dental earned a badge
      Week One Done
    • Community Regular
      vZeroG went up a rank
      Community Regular
    • Collaborator
      Snake Doc earned a badge
      Collaborator
    • Week One Done
      Snake Doc earned a badge
      Week One Done
    • One Month Later
      Johnny Mrkvička earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      594
    2. 2
      Michael Scrip
      197
    3. 3
      ATLien_0
      195
    4. 4
      +FloatingFatMan
      131
    5. 5
      Xenon
      122
  • Tell a friend

    Love Neowin? Tell a friend!