HTML代码
<head>
<title>Purdy designs</title>
<link href="css/main.css" type="text/css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
</head>
<body>
<header class="navbar-inverse" role="banner">
<div class="container">
<nav>
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
</header>
<div class="jumbotron">
<div class="container">
<h1>
Affordable website design packages from as low as £199
</h1>
<p>
Welcome to Purdy Website Design, If you need an affordable website to help you stand out from the crowd, you've come to the right place.
</p>
</div>
</div>
<div class="offer">
<div class="container">
<div class="row-fluid">
<div class="col-xs-4">
<div class="thumbnail">
<img src="http://dummyimage.com/242x200/f3f3f3/2d2d2d.png" alt="...">
<div class="caption">
<h3 class="text-center">Thumbnail 1</h3>
<p class="text-center">Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col-xs-4">
<div class="thumbnail">
<img src="http://dummyimage.com/242x200/f3f3f3/2d2d2d.png" alt="...">
<div class="caption">
<h3 class="text-center">Thumbnail 2</h3>
<p class="text-center">Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col-xs-4">
<div class="thumbnail">
<img src="http://dummyimage.com/242x200/f3f3f3/2d2d2d.png" alt="...">
<div class="caption">
<h3 class="text-center">Thumbnail 3</h3>
<p class="text-center">Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</body>
-----CSS------
.nav a {
color: #5a5a5a;
font-size: 11px;
font-weight: bold;
padding: 14px 10px;
text-transform: uppercase;
}
.nav li {
display: inline;
}
.offer {
background-color: #f7f7f7;
padding-top: 0px;
padding: 4px;
}
.body {
}
.thumbnail h3 {
font-family: 'Shift', sans-serif;
font-size: 18px;
font-weight: bold;
}
.thumbnail{
width: 250px;
height: 400px;
overflow: auto;
}
以下是我的缩略图,只有我的CSS工作的某些部分。例如 -
.thumbnail{
width: 250px;
height: 400px;
overflow: auto;
}
此代码的所有部分都有效,但在其他领域(例如
)时.thumbnail h3 {
font-family: 'Shift', sans-serif;
font-size: 18px;
font-weight: bold;
粗体和18px工作,但字体不会改变。对于其他部分也是如此 -
.offer {
background-color: #f7f7f7;
padding-top: 0px;
padding: 4px;
某些部分不起作用。有谁知道为什么?
CODEOPEN链接:http://codepen.io/anon/pen/LEzdGg
答案 0 :(得分:3)
您没有加载名为Shift的字体系列。您需要使用@ font-face加载字体,并在css中引用它。
以下是有关如何使用@ font-face加载字体的一些指导:
http://css-tricks.com/snippets/css/using-font-face/
.offer css工作得很好,但是在声明0 padding-top之后,你在所有四个边上声明了一个填充,所以你仍然在顶部得到一个填充。更好地重写:
.offer {
padding: 0 4px 4px; // Padding every side except top.