Bonjour,
Souci pour fixer la largeur d'une colonne de mon tableau.
La dernière colonne Qté doit être réduite
Contient 2 pages: page.php (html + php) et styles.css
NOTA: Il est nécessaire pour la page que la dernière colonne ne soit pas incluse dans la boucle while.
page.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="fr-fr">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<META http-equiv="Content-Language" content="fr" />
<TITLE>informatique</TITLE>
<LINK title="Feuille de styles CSS" rel="stylesheet" href="styles.css"
type="text/css" />
<LINK rel="shortcut icon" href="images/favicon.ico" />
<STYLE type="text/css">
</STYLE>
<script type="text/javascript">
</script>
</HEAD>
<BODY>
<div id="header">
<P class="position">header</P>
</div>
<div id="corps">
<div id="left">
<p class="position">left</p>
</div>
<div id="middle">
<p class="position">middle</p>
echo '<table border="1" class="table1">';
echo '
<tr class="tr1">
<TH class="[b]col1_4[/b]">Machine</TH>
<TH class="[b]col1_4[/b]">Code article</TH>
<TH class="[b]col1_4[/b]">Désignation</TH>
<TH class="[b]col1_4[/b]">PU HT</TH>
<TH class="[b]col5[/b]">Qté</TH>
</tr>';
//avec while
$no_ligne = 0;
while ($no_ligne<=4) //5 lignes
{
echo '<tr>';
$no_colonne = 0;
while ($no_colonne<=3) //4 colonnes
{
echo '<td class="[b]col1_4[/b]">';
echo "l".($no_ligne+1)."c".($no_colonne+1);
echo '</td>';
$no_colonne++;
}
echo '<td class="[b]col5[/b]">'; //+ une colonne
echo "l".($no_ligne+1)."c5";
echo '</td>';
echo '</tr>';
$no_ligne++;
}
echo '</table>';
<p> </p>
</div>
<div id="right">
<p class="position">right</p>
</div>
</div>
<div id="bottom">
<p class="position">bottom</p>
</div>
</BODY> </HTML>
styles.css
* {
margin: 0;
padding: 0;
}
body {
width: 1050px;
margin: 1px auto;
font-family: Verdana, Arial, Helvetica, sans-serif;
/*background-color: #CCFFFF;*/
/*background-color: #e0dedf;*/
background-color: #EDEDED;
}
#bottom {
clear: both;
width: 1050px;
height: 5px;
}
.col1_4 {
/*
max-width: 30px;
*/
width: 30px;
}
.col5 {
/*
max-width: 20px;
*/
width: 5px;
}
#corps {
float: left;
background-color: #ffffff;
height: 1050px;
}
#header {
width: 1050px;
height: 5px;
}
#left {
float: left;
width: 150px;
}
#middle {
float: left;
width: 700px;
/*height: 500px;*/
background-color: #EDEDED;
padding-left: 5px;
}
.position {
font-size: 0.6em;
color: #FF9966;
}
#right {
float: left;
width: 150px;
}
.table1{
background-color: #00FFFF;
width: 690px;
margin:0 auto;
}
.tr1 {
text-align: center;
}