我创建了引导程序 4 页面,菜单在桌面上显示正确,但在手机/平板电脑上显示不佳
尝试了一些bootstarp分类,但没有一个有效http://www.siz.co.il/my.php?i=jtmytbllnddm.jpg在桌面上 :http://www.siz.co.il/my.php?i=vdznmltzncwf.jpg
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<title>Document</title>
</head>
<nav class="navbar navbar-expand-lg navbar-light bg-primary">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-light my-2 my-sm-0 mr-5" type="submit">Create new auction</button>
</form>
<li class="nav-item dropdown mr-5">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false"><img src="images/avatar2.png" class="my-image rounded-circle"
alt="">
Harvey Matthews
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
</div>
</nav>
<div class="my-div bg-light">
<div class="row">
<div class="col-lg-8 col-sm-12">
<h1 class="ml-5 mt-5">New auction</h1>
</div>
<div class="input-group mt-5 mb-4 col-lg-2 col-sm-12">
<input placeholder="Load template" type="text" class="form-control text-primary" type="text" name="template"
id="template">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split text-primary"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-sm-12">
<p class="ml-5"> <u><span class="font-weight-bold">Pickup & Delivery details</span></u></p>
<p class="ml-5 font-weight-bold">Origin</p>
<div class="form-group ml-4 col-4">
<label for="companyName">Company name</label>
<input placeholder="Company name" class="form-control" type="text" name="companyName" id="companyName">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-4 col-sm-12">
<p class="text-primary"><i class="fas fa-book fa-lg"></i> Save as template</p>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-12">
<div class="form-group ml-4 col">
<label for="country">Country</label>
<input placeholder="Country" class="form-control" type="text" name="country" id="country">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="companyName2">City</label>
<div class="input-group ml-4 col">
<input placeholder="City" type="text" class="form-control" type="text" name="city" id="city">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="col-lg-2 col-sm-12">
<div class="form-group ml-4 col">
<label for="zipCode">ZIP Code</label>
<input placeholder="ZIP Code" class="form-control" type="text" name="zipCode" id="zipCode">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<div class="form-group ml-4 col">
<label for="address">Address</label>
<input placeholder="Address" class="form-control" type="text" name="address" id="address">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-12">
<p class="ml-5 font-weight-bold">Destination</p>
<div class="form-group ml-4 col-sm-12">
<label for="companyName2">Company name</label>
<input placeholder="Company name" class="form-control" type="text" name="companyName2" id="companyName2">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="companyName2">Country</label>
<div class="input-group ml-4 col">
<input placeholder="Country" type="text" class="form-control" type="text" name="country" id="country">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="companyName2">State / Province</label>
<div class="input-group ml-4 col">
<input placeholder="State / Province" type="text" class="form-control" type="text" name="state" id="country">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="city2">City</label>
<div class="input-group ml-4 col">
<input placeholder="City" type="text" class="form-control" type="text" name="city2" id="city2">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="col-lg-2 col-sm-12">
<div class="form-group ml-4 col">
<label for="zipCode2">ZIP Code</label>
<input placeholder="ZIP Code" class="form-control" type="text" name="zipCode2" id="zipCode2">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<div class="form-group ml-4 col">
<label for="address2">Address</label>
<input placeholder="Address" class="form-control" type="text" name="address2" id="address2">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div class="row align-items-center">
<div class="col-lg-3 col-sm-12">
<p class="ml-5 font-weight-bold">Pickup & Delivery dates</p>
<p class="ml-5">Pickup date</p>
<div class="form-group ml-4 col-lg-6 col-sm-12">
<input class="form-control" type="text" placeholder="15/6/19">
</div>
</div>
<div class="col-3"></div>
<div class="col-lg-3 col-sm-12 mt-5">
<p class="ml-5">Pickup date</p>
<div class="form-group ml-4 col-lg-6 col-sm-12">
<input class="form-control" type="text" placeholder="15/6/19">
</div>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div class="row align-items-center">
<div class="col-lg-3 col-sm-12">
<p class="ml-5 font-weight-bold">Pickup & Delivery time frames</p>
<p class="ml-5">Pickup time frame</p>
<p class="ml-5">
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Normal business hours</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Custom </span>
</p>
<div class="form-group ml-4 col-lg-4 col-sm-12">
<input class="form-control" type="text" placeholder="09:00"> -
<input class="form-control" type="text" placeholder="16:00">
</div>
</div>
<div class="col-3"></div>
<div class="col-lg-3 col-sm-12 mt-5">
<p class="ml-5">Delivery time frame</p>
<p class="ml-5">
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Normal business hours</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Custom </span>
</p>
<div class="form-group ml-4 col-lg-6 col-sm-12">
<input class="form-control" type="text" placeholder="09:00"> -
<input class="form-control" type="text" placeholder="16:00">
</div>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div class="row">
<div class="col-lg-12">
<p class="ml-5 font-weight-bold">Incoterms</p>
<p class="ml-5">
<input class="dap" id="dap" onclick="changeDiv()" type="radio"
aria-label="Radio button for following text input">
<span class="mr-2">DAP</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">DAT</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">CIP</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">CPT</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">FCA</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">EXW</span>
</p>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div id="changedDiv" class="row">
<div class="col">
<p class="ml-5 font-weight-bold">Shipping mode</p>
<p class="ml-5">
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Air</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Land</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">All</span>
</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-1"></div>
<div class="col-2">
<button class="btn btn-outline-primary btn-block">Back</button>
</div>
<div class="col-6"></div>
<div class="col-2">
<button class="btn btn-primary btn-block">Next</button>
</div>
<div class="col-1"></div>
</div>
</div>
</div>
<body>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<script src="js/script.js"></script>
</body>
</html>
我希望在移动设备上正确显示导航栏。
几件事:
- 在小型设备上,可折叠导航确实出现了,但在那里没有按钮来触发可折叠区域的打开/关闭;
- 为此按钮添加了已添加的相关
data-target="#navbarSupportedContent"
属性 - 您的代码在
<body>
标记之外
工作代码片段如下:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<nav class="navbar navbar-expand-lg navbar-light bg-primary">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<form class="form-inline my-2 ">
<button class="btn btn-outline-light my-2 my-sm-0 mr-5" type="submit">Create new auction</button>
</form>
<li class="nav-item dropdown mr-5">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="images/avatar2.png" class="my-image rounded-circle" alt=""> Harvey Matthews
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
</div>
</nav>
<div class="my-div bg-light">
<div class="row">
<div class="col-lg-8 col-sm-12">
<h1 class="ml-5 mt-5">New auction</h1>
</div>
<div class="input-group mt-5 mb-4 col-lg-2 col-sm-12">
<input placeholder="Load template" type="text" class="form-control text-primary" type="text" name="template" id="template">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split text-primary" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-sm-12">
<p class="ml-5"> <u><span class="font-weight-bold">Pickup & Delivery details</span></u></p>
<p class="ml-5 font-weight-bold">Origin</p>
<div class="form-group ml-4 col-4">
<label for="companyName">Company name</label>
<input placeholder="Company name" class="form-control" type="text" name="companyName" id="companyName">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-4 col-sm-12">
<p class="text-primary"><i class="fas fa-book fa-lg"></i> Save as template</p>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-12">
<div class="form-group ml-4 col">
<label for="country">Country</label>
<input placeholder="Country" class="form-control" type="text" name="country" id="country">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="companyName2">City</label>
<div class="input-group ml-4 col">
<input placeholder="City" type="text" class="form-control" type="text" name="city" id="city">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="col-lg-2 col-sm-12">
<div class="form-group ml-4 col">
<label for="zipCode">ZIP Code</label>
<input placeholder="ZIP Code" class="form-control" type="text" name="zipCode" id="zipCode">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<div class="form-group ml-4 col">
<label for="address">Address</label>
<input placeholder="Address" class="form-control" type="text" name="address" id="address">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-12">
<p class="ml-5 font-weight-bold">Destination</p>
<div class="form-group ml-4 col-sm-12">
<label for="companyName2">Company name</label>
<input placeholder="Company name" class="form-control" type="text" name="companyName2" id="companyName2">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="companyName2">Country</label>
<div class="input-group ml-4 col">
<input placeholder="Country" type="text" class="form-control" type="text" name="country" id="country">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="companyName2">State / Province</label>
<div class="input-group ml-4 col">
<input placeholder="State / Province" type="text" class="form-control" type="text" name="state" id="country">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-lg-3 col-sm-12">
<label class="ml-5" for="city2">City</label>
<div class="input-group ml-4 col">
<input placeholder="City" type="text" class="form-control" type="text" name="city2" id="city2">
<button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
</div>
</div>
<div class="col-lg-2 col-sm-12">
<div class="form-group ml-4 col">
<label for="zipCode2">ZIP Code</label>
<input placeholder="ZIP Code" class="form-control" type="text" name="zipCode2" id="zipCode2">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
<div class="col-lg-3 col-sm-12">
<div class="form-group ml-4 col">
<label for="address2">Address</label>
<input placeholder="Address" class="form-control" type="text" name="address2" id="address2">
<p class="text-danger font-weight-bold text-center"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div class="row align-items-center">
<div class="col-lg-3 col-sm-12">
<p class="ml-5 font-weight-bold">Pickup & Delivery dates</p>
<p class="ml-5">Pickup date</p>
<div class="form-group ml-4 col-lg-6 col-sm-12">
<input class="form-control" type="text" placeholder="15/6/19">
</div>
</div>
<div class="col-3"></div>
<div class="col-lg-3 col-sm-12 mt-5">
<p class="ml-5">Pickup date</p>
<div class="form-group ml-4 col-lg-6 col-sm-12">
<input class="form-control" type="text" placeholder="15/6/19">
</div>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div class="row align-items-center">
<div class="col-lg-3 col-sm-12">
<p class="ml-5 font-weight-bold">Pickup & Delivery time frames</p>
<p class="ml-5">Pickup time frame</p>
<p class="ml-5">
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Normal business hours</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Custom </span>
</p>
<div class="form-group ml-4 col-lg-4 col-sm-12">
<input class="form-control" type="text" placeholder="09:00"> -
<input class="form-control" type="text" placeholder="16:00">
</div>
</div>
<div class="col-3"></div>
<div class="col-lg-3 col-sm-12 mt-5">
<p class="ml-5">Delivery time frame</p>
<p class="ml-5">
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Normal business hours</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Custom </span>
</p>
<div class="form-group ml-4 col-lg-6 col-sm-12">
<input class="form-control" type="text" placeholder="09:00"> -
<input class="form-control" type="text" placeholder="16:00">
</div>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div class="row">
<div class="col-lg-12">
<p class="ml-5 font-weight-bold">Incoterms</p>
<p class="ml-5">
<input class="dap" id="dap" onclick="changeDiv()" type="radio" aria-label="Radio button for following text input">
<span class="mr-2">DAP</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">DAT</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">CIP</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">CPT</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">FCA</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">EXW</span>
</p>
</div>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<hr>
</div>
<div class="col-1"></div>
</div>
<div id="changedDiv" class="row">
<div class="col">
<p class="ml-5 font-weight-bold">Shipping mode</p>
<p class="ml-5">
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Air</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">Land</span>
<input type="radio" aria-label="Radio button for following text input">
<span class="mr-2">All</span>
</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-1"></div>
<div class="col-2">
<button class="btn btn-outline-primary btn-block">Back</button>
</div>
<div class="col-6"></div>
<div class="col-2">
<button class="btn btn-primary btn-block">Next</button>
</div>
<div class="col-1"></div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="js/script.js"></script>