猿问

响应式导航条的制作方法,我参照一个例子做的,但是就是无法适应手机屏幕大小,不知道问题出在哪

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" >

<script src="css/bootstrap/bootstrap.min.js"></script>

<script src="js/jquery-1.4.2.min.js"></script>

<link href="css/123.css" rel="stylesheet" />


<style type="text/css">

.navbar .logo {

float: left;

width: 240px;

background: url("images/HomePage/logo_2.png") no-repeat 50% 50%;

height: 68px;

overflow: hidden;

line-height: 208px;

font-size: 18px;

font-weight: bold;

color: #fff;

margin: 0;

}

</style>

<link href="123.css" rel="stylesheet" type="text/css" />

</head>

<body>

<header class="header">

      <nav class="navbar">

      <div class="navbar-header">

      <button type="button" class="navbar-toggle" data-toggle="collapse"

      data-target="#example-navbar-collapse">

      <span class="sr-only">切换导航</span>

      <span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

      </button>

      </div>

        <div class="logo"> <a href="images/HomePage/logo_2.png" ></a> </div>

        <div class="collapse navbar-collapse" id="example-navbar-collapse">

        <ul class="nav navbar-nav">

        <li> <a title="home" href="index.html">首页</a> </li>

          <li><a href="AboutUs.html">公司介绍</a></li>

        </ul>

        </div> 

      </nav>

    </header>


慕筱飞
浏览 2790回答 2
2回答

幕布斯6393831

噢,,刚没看到你引用了bootstrap,,,去看看文档,。

幕布斯6393831

用%做宽度单位,,必要时加上媒体查询
随时随地看视频慕课网APP
我要回答