Jump to content
  • 0

Горизонтальная верстка.


Atilla
 Share

Question

Надо горизонтально сверстать страницу.

Есть основной блок (id="main") и блоки поменьше (class="block"), шириной и высотой равные ширине и высоте страницы:

<div id="main">
<div class="block">
...
</div>
<div class="block">
...
</div>
<div class="block">
...
</div>
<div class="block">
...
</div>
...
</div>

Как при помощи css сверстать так, чтобы блоки class="block" стояли друг за дружкой по горизонтали, даже если выходят за границу экрана?

P.S. В интернетах рецепт при помощи javascript изменять ширину основного блока и float:left для блоков поменьше. Не хотелось бы использовать javascript...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

1)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru">

<head>
<title>An XHTML 1.0 Strict standard template</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />

<style type="text/css">
* {
margin: 0;
padding: 0;
}
div#main { white-space: nowrap;}
div.block { display: inline-block; width: 500px; height: 500px; background: red; margin: 0 3px;}

</style>
</head>

<body>
<div id="main">
<div class="block">
...
</div>
<div class="block">
...
</div>
<div class="block">
...
</div>
<div class="block">
...
</div>
...
</div>

</body>
</html>

2) Либо таблица

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