Representing Table with DIV












-3















I had a table



<td colspan="6">
<table width="100%" border="0">
<tr align="center">
<td width="5%"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></td>
<td width="7%"><strong>Item Id </strong></td>
<td width="20%"><strong>Item</strong></td>
<td width="17%"><strong>Type</strong></td>
<td width="17%"><strong>Rate</strong></td>
<td width="17%"><strong>Quantity</strong></td>
<td width="17%"><strong>Price</strong></td>
</tr>


I am representing the table through <DIV> like This



<div id="table">
<div class="row" id="row" align="center">
<div id="cell"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></div>
<div id="cell"><strong>Item Id </strong></div>
<div id="cell"><strong>Item</strong></div>
<div id="cell"><strong>Type</strong></div>
<div id="cell"><strong>Rate</strong></div>
<div id="cell"><strong>Quantity</strong></div>
<div id="cell"><strong>Price</strong></div>
</div>


but I can't find any replacement for colspan="6". Can anyone help?










share|improve this question




















  • 4





    There is no equivalent for div because a div has no concept of "columns" (it is a generic block tag). The correct question is why? Tables are for tabular data, which you have here. What would be the benefit of converting it to a div, which is a generic block element?

    – Burhan Khalid
    Jun 19 '12 at 11:55











  • Nesting tables like that is never a good idea. ou should probably rethink your structure. And no, replacing all elements with divs is not the solution.

    – Madara Uchiha
    Jun 19 '12 at 11:55






  • 3





    If you have tabular data, use <table>! You just should not use <table> for mere layout purposes.

    – Sirko
    Jun 19 '12 at 11:56






  • 2





    That looks like tabular data. Hence, you should use a <table>. Why are you trying to change to <div>s? Bad idea.

    – thirtydot
    Jun 19 '12 at 11:56













  • You should use th (with scope="col" attribute and value I guess) and not td in your first example: they seem like the headers for the rest of your tabular data.

    – FelipeAls
    Jun 19 '12 at 12:41


















-3















I had a table



<td colspan="6">
<table width="100%" border="0">
<tr align="center">
<td width="5%"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></td>
<td width="7%"><strong>Item Id </strong></td>
<td width="20%"><strong>Item</strong></td>
<td width="17%"><strong>Type</strong></td>
<td width="17%"><strong>Rate</strong></td>
<td width="17%"><strong>Quantity</strong></td>
<td width="17%"><strong>Price</strong></td>
</tr>


I am representing the table through <DIV> like This



<div id="table">
<div class="row" id="row" align="center">
<div id="cell"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></div>
<div id="cell"><strong>Item Id </strong></div>
<div id="cell"><strong>Item</strong></div>
<div id="cell"><strong>Type</strong></div>
<div id="cell"><strong>Rate</strong></div>
<div id="cell"><strong>Quantity</strong></div>
<div id="cell"><strong>Price</strong></div>
</div>


but I can't find any replacement for colspan="6". Can anyone help?










share|improve this question




















  • 4





    There is no equivalent for div because a div has no concept of "columns" (it is a generic block tag). The correct question is why? Tables are for tabular data, which you have here. What would be the benefit of converting it to a div, which is a generic block element?

    – Burhan Khalid
    Jun 19 '12 at 11:55











  • Nesting tables like that is never a good idea. ou should probably rethink your structure. And no, replacing all elements with divs is not the solution.

    – Madara Uchiha
    Jun 19 '12 at 11:55






  • 3





    If you have tabular data, use <table>! You just should not use <table> for mere layout purposes.

    – Sirko
    Jun 19 '12 at 11:56






  • 2





    That looks like tabular data. Hence, you should use a <table>. Why are you trying to change to <div>s? Bad idea.

    – thirtydot
    Jun 19 '12 at 11:56













  • You should use th (with scope="col" attribute and value I guess) and not td in your first example: they seem like the headers for the rest of your tabular data.

    – FelipeAls
    Jun 19 '12 at 12:41
















-3












-3








-3








I had a table



<td colspan="6">
<table width="100%" border="0">
<tr align="center">
<td width="5%"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></td>
<td width="7%"><strong>Item Id </strong></td>
<td width="20%"><strong>Item</strong></td>
<td width="17%"><strong>Type</strong></td>
<td width="17%"><strong>Rate</strong></td>
<td width="17%"><strong>Quantity</strong></td>
<td width="17%"><strong>Price</strong></td>
</tr>


I am representing the table through <DIV> like This



<div id="table">
<div class="row" id="row" align="center">
<div id="cell"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></div>
<div id="cell"><strong>Item Id </strong></div>
<div id="cell"><strong>Item</strong></div>
<div id="cell"><strong>Type</strong></div>
<div id="cell"><strong>Rate</strong></div>
<div id="cell"><strong>Quantity</strong></div>
<div id="cell"><strong>Price</strong></div>
</div>


but I can't find any replacement for colspan="6". Can anyone help?










share|improve this question
















I had a table



<td colspan="6">
<table width="100%" border="0">
<tr align="center">
<td width="5%"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></td>
<td width="7%"><strong>Item Id </strong></td>
<td width="20%"><strong>Item</strong></td>
<td width="17%"><strong>Type</strong></td>
<td width="17%"><strong>Rate</strong></td>
<td width="17%"><strong>Quantity</strong></td>
<td width="17%"><strong>Price</strong></td>
</tr>


I am representing the table through <DIV> like This



<div id="table">
<div class="row" id="row" align="center">
<div id="cell"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></div>
<div id="cell"><strong>Item Id </strong></div>
<div id="cell"><strong>Item</strong></div>
<div id="cell"><strong>Type</strong></div>
<div id="cell"><strong>Rate</strong></div>
<div id="cell"><strong>Quantity</strong></div>
<div id="cell"><strong>Price</strong></div>
</div>


but I can't find any replacement for colspan="6". Can anyone help?







html css html-table






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 16:46









Brian Tompsett - 汤莱恩

4,2231338101




4,2231338101










asked Jun 19 '12 at 11:51









JANNURMJANNURM

1661313




1661313








  • 4





    There is no equivalent for div because a div has no concept of "columns" (it is a generic block tag). The correct question is why? Tables are for tabular data, which you have here. What would be the benefit of converting it to a div, which is a generic block element?

    – Burhan Khalid
    Jun 19 '12 at 11:55











  • Nesting tables like that is never a good idea. ou should probably rethink your structure. And no, replacing all elements with divs is not the solution.

    – Madara Uchiha
    Jun 19 '12 at 11:55






  • 3





    If you have tabular data, use <table>! You just should not use <table> for mere layout purposes.

    – Sirko
    Jun 19 '12 at 11:56






  • 2





    That looks like tabular data. Hence, you should use a <table>. Why are you trying to change to <div>s? Bad idea.

    – thirtydot
    Jun 19 '12 at 11:56













  • You should use th (with scope="col" attribute and value I guess) and not td in your first example: they seem like the headers for the rest of your tabular data.

    – FelipeAls
    Jun 19 '12 at 12:41
















  • 4





    There is no equivalent for div because a div has no concept of "columns" (it is a generic block tag). The correct question is why? Tables are for tabular data, which you have here. What would be the benefit of converting it to a div, which is a generic block element?

    – Burhan Khalid
    Jun 19 '12 at 11:55











  • Nesting tables like that is never a good idea. ou should probably rethink your structure. And no, replacing all elements with divs is not the solution.

    – Madara Uchiha
    Jun 19 '12 at 11:55






  • 3





    If you have tabular data, use <table>! You just should not use <table> for mere layout purposes.

    – Sirko
    Jun 19 '12 at 11:56






  • 2





    That looks like tabular data. Hence, you should use a <table>. Why are you trying to change to <div>s? Bad idea.

    – thirtydot
    Jun 19 '12 at 11:56













  • You should use th (with scope="col" attribute and value I guess) and not td in your first example: they seem like the headers for the rest of your tabular data.

    – FelipeAls
    Jun 19 '12 at 12:41










4




4





There is no equivalent for div because a div has no concept of "columns" (it is a generic block tag). The correct question is why? Tables are for tabular data, which you have here. What would be the benefit of converting it to a div, which is a generic block element?

– Burhan Khalid
Jun 19 '12 at 11:55





There is no equivalent for div because a div has no concept of "columns" (it is a generic block tag). The correct question is why? Tables are for tabular data, which you have here. What would be the benefit of converting it to a div, which is a generic block element?

– Burhan Khalid
Jun 19 '12 at 11:55













Nesting tables like that is never a good idea. ou should probably rethink your structure. And no, replacing all elements with divs is not the solution.

– Madara Uchiha
Jun 19 '12 at 11:55





Nesting tables like that is never a good idea. ou should probably rethink your structure. And no, replacing all elements with divs is not the solution.

– Madara Uchiha
Jun 19 '12 at 11:55




3




3





If you have tabular data, use <table>! You just should not use <table> for mere layout purposes.

– Sirko
Jun 19 '12 at 11:56





If you have tabular data, use <table>! You just should not use <table> for mere layout purposes.

– Sirko
Jun 19 '12 at 11:56




2




2





That looks like tabular data. Hence, you should use a <table>. Why are you trying to change to <div>s? Bad idea.

– thirtydot
Jun 19 '12 at 11:56







That looks like tabular data. Hence, you should use a <table>. Why are you trying to change to <div>s? Bad idea.

– thirtydot
Jun 19 '12 at 11:56















You should use th (with scope="col" attribute and value I guess) and not td in your first example: they seem like the headers for the rest of your tabular data.

– FelipeAls
Jun 19 '12 at 12:41







You should use th (with scope="col" attribute and value I guess) and not td in your first example: they seem like the headers for the rest of your tabular data.

– FelipeAls
Jun 19 '12 at 12:41














3 Answers
3






active

oldest

votes


















3














OK, let's get this straight for the 100th time.



Tables are not evil.



Tables are for tabular data. If you have headers, rows or columns, then it's cool. Tables are the thing to use.



In HTML. Tables.



Misusing elements is evil



Using any element for the wrong reason is wrong.



h1 for images



table for layout



button for links



These things are wrong. And bad.



Summary



Use tables for tables, not for layout, and everyone will be happy.






share|improve this answer
























  • +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

    – FelipeAls
    Jun 19 '12 at 12:38













  • Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

    – Rich Bradshaw
    Jun 19 '12 at 12:43






  • 1





    Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

    – FelipeAls
    Jun 19 '12 at 12:44





















1














Div do not use concept of columns. You can have as many as you want, div's in a row. You can fix width of div and then can use them to build up table. By the way you can go for css framework like bootstrap will be much more efficient.






share|improve this answer































    0














    Make the div width in such a way that, it will occupy "TD" sections.



    For that you just need to add one more class with some higher width in it and some less div on the new row.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11100316%2frepresenting-table-with-div%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      OK, let's get this straight for the 100th time.



      Tables are not evil.



      Tables are for tabular data. If you have headers, rows or columns, then it's cool. Tables are the thing to use.



      In HTML. Tables.



      Misusing elements is evil



      Using any element for the wrong reason is wrong.



      h1 for images



      table for layout



      button for links



      These things are wrong. And bad.



      Summary



      Use tables for tables, not for layout, and everyone will be happy.






      share|improve this answer
























      • +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

        – FelipeAls
        Jun 19 '12 at 12:38













      • Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

        – Rich Bradshaw
        Jun 19 '12 at 12:43






      • 1





        Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

        – FelipeAls
        Jun 19 '12 at 12:44


















      3














      OK, let's get this straight for the 100th time.



      Tables are not evil.



      Tables are for tabular data. If you have headers, rows or columns, then it's cool. Tables are the thing to use.



      In HTML. Tables.



      Misusing elements is evil



      Using any element for the wrong reason is wrong.



      h1 for images



      table for layout



      button for links



      These things are wrong. And bad.



      Summary



      Use tables for tables, not for layout, and everyone will be happy.






      share|improve this answer
























      • +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

        – FelipeAls
        Jun 19 '12 at 12:38













      • Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

        – Rich Bradshaw
        Jun 19 '12 at 12:43






      • 1





        Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

        – FelipeAls
        Jun 19 '12 at 12:44
















      3












      3








      3







      OK, let's get this straight for the 100th time.



      Tables are not evil.



      Tables are for tabular data. If you have headers, rows or columns, then it's cool. Tables are the thing to use.



      In HTML. Tables.



      Misusing elements is evil



      Using any element for the wrong reason is wrong.



      h1 for images



      table for layout



      button for links



      These things are wrong. And bad.



      Summary



      Use tables for tables, not for layout, and everyone will be happy.






      share|improve this answer













      OK, let's get this straight for the 100th time.



      Tables are not evil.



      Tables are for tabular data. If you have headers, rows or columns, then it's cool. Tables are the thing to use.



      In HTML. Tables.



      Misusing elements is evil



      Using any element for the wrong reason is wrong.



      h1 for images



      table for layout



      button for links



      These things are wrong. And bad.



      Summary



      Use tables for tables, not for layout, and everyone will be happy.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jun 19 '12 at 12:17









      Rich BradshawRich Bradshaw

      51.8k39157231




      51.8k39157231













      • +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

        – FelipeAls
        Jun 19 '12 at 12:38













      • Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

        – Rich Bradshaw
        Jun 19 '12 at 12:43






      • 1





        Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

        – FelipeAls
        Jun 19 '12 at 12:44





















      • +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

        – FelipeAls
        Jun 19 '12 at 12:38













      • Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

        – Rich Bradshaw
        Jun 19 '12 at 12:43






      • 1





        Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

        – FelipeAls
        Jun 19 '12 at 12:44



















      +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

      – FelipeAls
      Jun 19 '12 at 12:38







      +1 but I didn't understand "h1 for images (is evil)". h1>img[alt] seems fine to me, if it's a real heading and if it can't be done in CSS (when WCAG2 Technique C30 w3.org/TR/WCAG-TECHS/C30.html ) can't be applied)

      – FelipeAls
      Jun 19 '12 at 12:38















      Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

      – Rich Bradshaw
      Jun 19 '12 at 12:43





      Yeah, good point. I must admit that it did cross my mind when I wrote it. Perhaps imagine that every image on the page was an H1.

      – Rich Bradshaw
      Jun 19 '12 at 12:43




      1




      1





      Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

      – FelipeAls
      Jun 19 '12 at 12:44







      Oh the sort of CMS where everything is an image created server-side? OK I'm glad I don't work or see this sort of creepy/crappy project :)

      – FelipeAls
      Jun 19 '12 at 12:44















      1














      Div do not use concept of columns. You can have as many as you want, div's in a row. You can fix width of div and then can use them to build up table. By the way you can go for css framework like bootstrap will be much more efficient.






      share|improve this answer




























        1














        Div do not use concept of columns. You can have as many as you want, div's in a row. You can fix width of div and then can use them to build up table. By the way you can go for css framework like bootstrap will be much more efficient.






        share|improve this answer


























          1












          1








          1







          Div do not use concept of columns. You can have as many as you want, div's in a row. You can fix width of div and then can use them to build up table. By the way you can go for css framework like bootstrap will be much more efficient.






          share|improve this answer













          Div do not use concept of columns. You can have as many as you want, div's in a row. You can fix width of div and then can use them to build up table. By the way you can go for css framework like bootstrap will be much more efficient.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 19 '12 at 12:13









          AnkurAnkur

          529




          529























              0














              Make the div width in such a way that, it will occupy "TD" sections.



              For that you just need to add one more class with some higher width in it and some less div on the new row.






              share|improve this answer




























                0














                Make the div width in such a way that, it will occupy "TD" sections.



                For that you just need to add one more class with some higher width in it and some less div on the new row.






                share|improve this answer


























                  0












                  0








                  0







                  Make the div width in such a way that, it will occupy "TD" sections.



                  For that you just need to add one more class with some higher width in it and some less div on the new row.






                  share|improve this answer













                  Make the div width in such a way that, it will occupy "TD" sections.



                  For that you just need to add one more class with some higher width in it and some less div on the new row.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 19 '12 at 11:57









                  Sudip PalSudip Pal

                  1,7971715




                  1,7971715






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11100316%2frepresenting-table-with-div%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Monofisismo

                      Angular Downloading a file using contenturl with Basic Authentication

                      Olmecas