Jump to content
  • 0

3 DIVа с центровкой среднего


ajborman
 Share

Question

Можно ли эту таблицу записать DIVами и CSSками?


<html>
<body>
<table width=100%>
<tr>
<td>1</td>
<td width=900>2</td>
<td>3</td>
</tr>
</table>
</body>
</html>

Суть в том, надо создать 3 DIVа в одну линию и чтоб они были растянуты на всю ширину экрана не зависимо от разрешения.

Центральный DIV имеет заданную ширину в пикселях, а два крайних одинаковую ширину в зависимости от разрешения экрана.

Edited by ajborman
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Резиновый трехколонный макет

Вот пример

HTML+CSS код

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Три колонки</title>
<style type="text/css">
.wrap{
background-color: #333;
position: relative;
}
.wrap div{
position: absolute;
height: 200px;
}
.col-1{
background-color: #1E90FF;
left: 0;
right: 50%;
margin-right:150px;
}
.col-2{
background-color: #CD5C5C;
width: 300px;
left: 50%;
margin-left: -150px;
}
.col-3{
background-color: #7CFC00;
right: 0;
left:50%;
margin-left: 150px;
}
</style>
</head>
<body>
<div class="wrap">
<div class="col-1">первая колонка</div>
<div class="col-2">вторая колонка</div>
<div class="col-3">третья колонка</div>
</div>
</body>
</html>

Edited by mrnobody
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy