简体   繁体   中英

Logo does not appear on bootstrap navbar

I am practicing bootstrap, and are having difficulties displaying the logo where it doesn't show. Can you take a look and explain what is going on?

The HTML5:

    <!DOCTYPE html>
<html class="responsive">
    <head>
        <title>Whatcha Cravin? | Home</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8">
        <link rel="stylesheet" href="assets\css\style.css" type="text/css">
        <link rel="stylesheet" href="assets\css\bootstrap.css" type="text/css">
        <link rel="stylesheet" href="assets\css\bootstrap.min.css" type="text/css">
    </head>
    <body>
    <!-- Navbar -->
        <nav class="nav">
            <div class="container">
                <div class="pull-left">
                    <a href="#">
                        <img href="assets/images/Logo_Transparent_Backround.PNG" class="image-responsive">
                    </a>
                </div>
                <ul class="list-inline pull-right">
                    <li class="list-unstyled"><a href="#" class="home">Home</a></li>
                    <li class="list-unstyled"><a href="#" class="menu">Our menu</a></li>
                    <li class="list-unstyled"><a href="#" class="about">About Us</a></li>
                    <li class="list-unstyled"><a href="#" class="contact">Contact Us</a></li>
                </ul>
            </div>
            <div class="jumbotron"/>
        </nav>
    <!-- /Navbar -->

    </body>
</html>

This is where I don't understand, maybe my CSS is incorrect?

.nav li a{
    color: #000;
    font-size: 15px;
    font-weight: bold;
    padding:14px 10px;
    text-transform: uppercase;
}
.jumbotron{
    background-image:url(../images/image1-3-edited_1.jpg);
    background-repeat:no-repeat;
    background-size:cover;
    height:599px;
    margin-top:3px;
    width:100%;
}
.nav li a:hover{
    background-color:#b23739;
    color:#fff;
}
.nav{
    margin-top:10px;
    width:100%;
}
.logo{
    height:100px;
    width:200px;
    margin-top:-100px;
    overflow:none;
}
.list-inline{
    vertical-align:auto;
}

在img标签中将href更改为src。

When calling an image you need to use

<img src="someImage.jpg" alt="" />

I have changed the code in a fiddle here is the update

http://jsfiddle.net/ccedgLqy/

<body>
<!-- Navbar -->
    <nav class="nav">
        <div class="container">
            <div class="pull-left">
                <a href="#">
                    <img src="http://www.xbox.com/shell/images/shell/XboxLogo.png" class="image-responsive">
                </a>
            </div>
            <ul class="list-inline pull-right">
                <li class="list-unstyled"><a href="#" class="home">Home</a></li>
                <li class="list-unstyled"><a href="#" class="menu">Our menu</a></li>
                <li class="list-unstyled"><a href="#" class="about">About Us</a></li>
                <li class="list-unstyled"><a href="#" class="contact">Contact Us</a></li>
            </ul>
        </div>
        <div class="jumbotron"/>
    </nav>
<!-- /Navbar -->

</body>

.nav li a{
color: #000;
font-size: 15px;
font-weight: bold;
padding:14px 10px;
text-transform: uppercase;
}
.jumbotron{
    background-image:url(../images/image1-3-edited_1.jpg);
    background-repeat:no-repeat;
    background-size:cover;
    height:599px;
    margin-top:3px;
    width:100%;
}
.nav li a:hover{
background-color:#b23739;
color:#fff;
}
.nav{
margin-top:10px;
width:100%;
}
.logo{
    height:100px;
   width:200px;
    margin-top:-100px;
    overflow:none;
}
.list-inline{
    vertical-align:auto;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM