图像不显示在标题上

时间:2018-05-13 07:36:56

标签: html css twitter-bootstrap bootstrap-4 frontend

徽标(图像链接正确)未显示在标题上。你知道为什么吗?是不是允许它的某种引导类?

这是HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="C:\Users\Gianpa\Desktop\banco di prova coding\sito prova\css\bootstrap.min.css">
    <link rel="stylesheet" href="C:\Users\Gianpa\Desktop\banco di prova coding\sito prova\css\banco prova css.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
  </script>
 <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>

  <header>
    <nav class="navbar navbar-default">
  <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" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a id="logoheader" class="navbar-brand" href="#"></a>
    </div>

      <!-- general menu for all devices except xs ones --> 
      <ul class="nav navbar-nav navbar-right visible-lg visible-md visible-sm">
        <li><a href="#">Home</a></li>
        <li><a href="#">Servizi</a></li>
        <li><a href="#">Contattaci</a></li>
        <li><a href="#">Referenze</a></li>
      </ul>

      <!-- Menu on the right -->
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul id="navlist" class="nav navbar-nav hidden visible-xs">
        <li><a href="#">Home</a></li>
        <li><a href="#">Servizi</a></li>
        <li><a href="#">Contattaci</a></li>
        <li><a href="#">Referenze</a></li>
      </ul>
    </div>
  </div>
</nav>
</header>
</body>
<div class="jumbotron">
  <h1 class="display-4">Hello, world!</h1>
  <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
  <hr class="my-4">
  <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
  <p class="lead">
    <a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
  </p>
</div>

CSS文件:

body {background-color: #d4f9f7;
font-family: 'Raleway', sans-serif;}

#logoheader {
background: url('C:\Users\Gianpa\Desktop\banco di prova coding\sito prova\images\logo.jpg');
width: 150px;
height: 150px;
margin: 20px 20px 10px 0;}

1 个答案:

答案 0 :(得分:0)

你需要使用相对路径,所以不要写: C:\ Users \ Gianpa \ Desktop \ banco di prova coding \ sito prova \ css \ bootstrap.min.css&#34; , 你可以使用 / sito prova / css / bootstrap.min.css&#34; 提供 banco di prova coding 是您正在使用的根目录。

由于此路径问题,徽标未显示。在你的CSS中,尝试更改 url('C:\Users\Gianpa\Desktop\banco di prova coding\sito prova\images\logo.jpg');url('/sito prova/images/logo.jpg');

您可以在此处详细了解相对和绝对路径:https://www.w3schools.com/html/html_filepaths.asp