Вёрстка « Зафиксировать слой для прокрутки по горизонтали

Привет.

Нужно зафиксировать div при прокрутке по горизонтали только. Но чтобы он по вертикали вел себя как обычно.
position: fixed фиксирует по двум осям сразу - не подходит.

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">
<head>
  <link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
  <div class="header">
    <h2>Шапка</h2>
  </div>
  <div class="content">
    <div class="item">
      Text
    </div>
    <div class="item">
      Text
    </div>
    <div class="item">
      Text
    </div>
    <div class="item">
      Text
    </div>
    <div class="item">
      Text
    </div>
    <div class="item">
      Text
    </div>
  </div>
</body>
</html>
 


.header {
  width: 100%;
}

.content {
  width: 100%;
  overflow-x: scroll;
  white-space: nowrap;
}

.item {
  white-space:normal;
  display: inline-block;
  margin: 10px;
  width: 300px;
  height: 1000px;
  background: #F0F0F0;
}
 

ы, загнался