我是一名视觉设计师,正在努力编写代码,切入正题,以下是问题:
我想要达到的目标:
目标 1 和目标 2 的屏幕截图,包括我目前的困境,我在下面放置了一个链接(因为我是新手,所以我还不允许包含屏幕截图:
https://www.dropbox.com/s/libc4wp970xz3ms/Screenshot.png?dl=0
我希望实现的是让导航栏始终居中。我把它变宽(1300px),我的白色容器会更小,它之外的任何东西都会被设置为隐藏。
下面是我的代码:
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Example Page</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="css/screen.css">
</head>
<body>
<div class ="main-container">
<div class = "banner-container">
<div class="cyan-banner"></div>
<div class="green-banner"></div>
<div class="magenta-banner"></div>
<div class="orange-banner"></div>
</div><!--end of .banner-container-->
</div><!--end of .main-container-->
</body>
</html>
@import 'normalize';
@import 'susy';
@import 'compass';
$susy : (
columns: 12,
debug: (image: show),
output: overlay
);
.main-container {
@include clearfix;
@include container(1200px);
height: 100vh; // Forces wrap to full height.
// Mobile
@media (max-width: 419px) {
@include show-grid(1);
}
// Changing to a 4 column grid
@media (min-width: 420px) {
@include show-grid(4);
}
// Changing to a 8 column grid
@media (min-width: 841px) {
@include show-grid(8);
}
// Changing to a 12 column grid
@media (min-width: 1200px) {
@include show-grid(12);
}
}
// Color Theme
$cyan: #148ec3; $magenta: #c9197a; $orange: #de8826; $green: #008a52; $gray: #a1a1a0;
body {
background: #d2d2d2;
}
.main-container {
background: white;
}
.banner-container {
@include clearfix;
}
.banner-container > div {
width: 1300px;
position: fixed;
top: 50px;
}
.cyan-banner {
height: 60px;
background: $cyan;
z-index: 5;
}
.green-banner {
height: 60px;
background: $green;
z-index: 4;
@include transform(rotate(2deg));
}
.magenta-banner {
height: 60px;
background: $magenta;
z-index: 3;
@include transform(rotate(4deg));
}
.orange-banner {
height: 60px;
background: $orange;
z-index: 2;
@include transform(rotate(-2deg));
}
任何帮助或建议将不胜感激。
我一直在论坛上寻找答案和线索,但似乎找不到与我有类似问题的论坛。
再次感谢你。
安东尼