Skip to content

Instantly share code, notes, and snippets.

@alanfm
Last active October 21, 2016 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanfm/834a3abda7803f6b719d89191dc264e8 to your computer and use it in GitHub Desktop.
Save alanfm/834a3abda7803f6b719d89191dc264e8 to your computer and use it in GitHub Desktop.
Estrutura
<style>
.table {
width: 600px;
box-sizing: border-box;
border: 1px solid #000;
}
.row {
width: 100%;
display: flex;
flex-direction: row;
}
.cell {
width: 298px;
flex-basis: auto;
margin: 2px;
padding: 2px;
border: 1px solid #000;
text-align: center;
}
.t-head {
text-align: center;
font-weight: bold;
}
</style>
<?php
/**
* Esse vetor representa o resultado da sua consulta no banco de dados
*/
$v = [['id'=>1, 'name'=>'Fulano', 'role'=>'Programador'],
['id'=>2, 'name'=>'Sicrano', 'role'=>'Analista'],
['id'=>3, 'name'=>'Beltrano', 'role'=>'DBA']];
?>
<div class="table">
<div class="row">
<div class="cell t-head">#id</div>
<div class="cell t-head">Name</div>
<div class="cell t-head">Role</div>
</div>
<?php foreach($v as $value): ?>
<div class="row">
<div class="cell"><?=$value['id'];?></div>
<div class="cell"><?=$value['name'];?></div>
<div class="cell"><?=$value['role'];?></div>
</div>
<?php endforeach;?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment