Layout de divisão:largura estática da coluna esquerda, largura da coluna direita strechacle

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

  •  23-09-2019
  •  | 
  •  

Pergunta

%19 Largura da seção esquerda, %80 Largura do conteúdo:

alt text

Mas quero corrigir a seção esquerda para 200px e a seção de conteúdo é o restante da largura da área visível.

Como posso fazer isso com 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>
Foi útil?

Solução

Há muitos modelos prontos que funcionariam aqui, dê uma olhada neles, por exemplo:

Outras dicas

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top