Div Disposition: Largeur de la colonne de gauche statique, strechacle largeur de la colonne de droite

StackOverflow https://stackoverflow.com/questions/2146455

  •  23-09-2019
  •  | 
  •  

Question

% 19 Left Section Largeur, 80% largeur Contenu:

text alt

Mais je veux fixer la section gauche à 200px et la section de contenu est le reste de la largeur de la zone visible.

Comment puis-je faire avec CSS?

<html>
<head>
    <title>TWO-COLUMN LIQUID LAYOUT WITH FLOATING BOXES</title>
    <style type="text/css">
        body
        {
            margin: 0px;
            padding: 0px;
        }
        div
        {
            border: 1px solid black;
        }
        #header
        {
            background: #0f0;
            width: 100%;
        }
        #leftcol
        {
            background: #f00;
            float: left;
            width:19%;
            /* max-width: 200px; */ 
            height: 500px;
        }
        #content
        {
            background: #fff;
            float: left;
            width: 80%;
            height: 500px;
        }
        #footer
        {
            background: #0f0;
            clear: both;
            width: 100%;
        }
    </style>
</head>
<body>
    <div id="header">
        Header Section</div>
    <div id="leftcol">
        Left Section</div>
    <div id="content">
        Content Section</div>
    <div id="footer">
        Footer Section</div>
</body>
</html>
Était-ce utile?

La solution

Il y a beaucoup de modèles prêts à l'emploi qui fonctionnerait ici, jetez un oeil à ces par exemple:

Autres conseils

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top