-3

I am still very new to all of this and looking for a bit of guidance.

So I am generating a table with buttons from a query:

$column = 0;
echo "<table class='fullheight' >";


   while($row = $rs->fetch_assoc()) {
        if ($column == 0) {
        echo "<tr>";
        }
    echo "<td ><input type='button' class='submitbtn' value='".$row['name']."'> </td>";

    $column++;
        if ($column >= 5) {echo "</tr>";
            $column=0;
        }
    }

    echo "</table>";

Some of the style sheet entries:

.fullheight{
    height:85%;
    width: 100%;
}

.submitbtn{
height:100%;
width: 100%;
opacity: 0.5;
cursor:pointer; 
padding:5px 0px; 
background:#35b128;
border:1px solid #33842a; 

-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;

-webkit-box-shadow: 0 0 4px rgba(0,0,0, .75);
-moz-box-shadow: 0 0 4px rgba(0,0,0, .75);
box-shadow: 0 0 4px rgba(0,0,0, .75);

color:#f3f3f3;
font-size:1.1em;
}
.submitbtn:hover,.submitbtn:focus{
background-color :#399630; 

-webkit-box-shadow: 0 0 1px rgba(0,0,0, .75);
-moz-box-shadow: 0 0 1px rgba(0,0,0, .75);
box-shadow: 0 0 1px rgba(0,0,0, .75);
opacity: 1;

color:#ffff00;
font-size:1.1em;
}

I am trying to learn CSS and to build a page the "correct" way.

I have the table generated within the content part of my page.

My question at this point is: Should I be generating a table to do the layout of these buttons, and if not, How do I iterate the the placement of the buttons using CSS?

I ask as I am already starting to run into issues with the text size within the buttons, especially during windows resize.

Bill Flippen
  • 453
  • 1
  • 4
  • 19
  • possible duplicate of [DIVs vs. TABLEs a rebuttal please](http://stackoverflow.com/questions/96137/divs-vs-tables-a-rebuttal-please) – user229044 Dec 15 '14 at 23:16
  • 1
    There seem to be 3 questions here: one is a matter of opinion ("should I use tables here?"), the second is connected but not very clear ("how do I iterate the placement of the buttons?"), and the third seems to be an unrelated afterthought. – IMSoP Dec 15 '14 at 23:18
  • @IMSoP yes there is 3 questions, but they are all tied together. yes the first one is a matter of opinion, but does what I am trying to do (create a dynamic grid of submit buttons) fall into a best practice situation. If that best practice stipulates using divs, how do you simulate a table, finally one of the reasons to use divs is for the resizing benefits, how would one optimize the resizing of `` if the best practice is the use of a table – Bill Flippen Dec 16 '14 at 00:56
  • The reason I mention it is that "too subjective", "unclear", and multiple questions rolled into one are all on the lists of things to avoid in the [help], which is why this question is getting negative votes. – IMSoP Dec 16 '14 at 00:59
  • @IMSoP ok I clarified the vagueness of the question and removed the 2nd follow-up question. I ask "should I use tables" because I do not know. I am not trying to spark a debate, I simply want to know if I am following a standard. I semi-successfully did it with a table, but I am unsure of that being the right way to go about things moving forward. If I was to ask "should I use `frames` I am sure I would get a resounding no. – Bill Flippen Dec 16 '14 at 01:17

1 Answers1

1

Use a table to present data, and use divs for layout.

Eeji
  • 1,648
  • 3
  • 17
  • 22