2015-10-02 4 views
4

Я создаю сайт, чтобы я мог практиковать свои навыки работы в Интернете, но у меня возникла проблема. Проблема заключается в том, что веб-страница находится на мобильном телефоне, например, крах Navbar, поэтому он подходит для устройства, но когда они нажимают кнопку Navbar-Toggle, ссылки попадают в верхнюю часть заголовка, который у меня есть, и я не хочу, чтобы это бывает. Я хочу, чтобы это произошло, когда они нажимают на нее, она перемещает все элементы вниз, если вы понимаете, что я имею в виду.Сделать страницу вниз, нажав кнопку Navbar-Toggle

Если вы не заходите на этот сайт -> www.thestartupguys.co.uk < - и сжимайте страницу до тех пор, пока она не станет, где вы должны переключить навигационную панель, а затем переключите ее, и вы увидите перемещение заголовка вниз.

Standard CSS Custom CSS

+0

Можете ли вы поделиться ваш код, так что мы можем помочь ты лучше? –

+0

Покажите свой код, пожалуйста. Не могу сказать много, не видя, что вы пробовали до сих пор. – mico

+0

Что вы пытаетесь сделать, это поведение навигационной панели Bootstrap по умолчанию, если вы не добавили правила CSS или используете фиксированную позицию nav. Вы должны опубликовать свой код (HTML/CSS/JS) https://stackoverflow.com/help/mcve – vanburen

ответ

4

Эти правила вызывают его: См рабочий пример.

Remove Высота: 50 и маржа-топ: 20px

.navbar-brand img, 
.navbar-nav { 
    margin-top: 20px; 
    display: inline; 
    text-transform: uppercase; 
    height: 50px; 
} 

Remove высота: 90px

.navbar-default { 
    font-family: 'Raleway', sans-serif; 
    height: 90px; 
    background-color: #fff; 
    box-shadow: 0px 2px 20px 0px rgba(0, 0, 0, 0.25); 
} 

@import url(https://fonts.googleapis.com/css?family=Raleway:100, 200, 300, 400, 500, 600, 700, 800, 900); 
 
@import url(https://fonts.googleapis.com/css?family=Lato); 
 

 
/*! 
 
Main Page CSS || Created By Stephen Hinett | Crafted-Solutions 
 
*/ 
 

 
* { 
 
    margin: 0px; 
 
    padding: 0px; 
 
} 
 
/* 
 
    
 
* BASIC STYLE 
 
- Headers and Paragraphs 
 
    
 
* GLOBAL STYLE 
 
- Navbar 
 
- Header 
 
    
 
*/ 
 

 
/*===========================================================================================*/ 
 

 
/* Headings & Paragraphs ------------------------- */ 
 

 
/*===========================================================================================*/ 
 

 
h1, 
 
h2, 
 
h3, 
 
h4, 
 
h5, 
 
h6 { 
 
    font-family: 'Raleway', sans-serif, serif; 
 
    color: #474747; 
 
} 
 
p { 
 
    color: #9E9E9E; 
 
    font-family: 'Raleway', sans-serif, serif; 
 
} 
 
/*===========================================================================================*/ 
 

 
/* Navbar ------------------------- */ 
 

 
/*===========================================================================================*/ 
 

 
.navbar.navbar-default { 
 
    font-family: 'Raleway', sans-serif; 
 
    background-color: #fff; 
 
    box-shadow: 0px 2px 20px 0px rgba(0, 0, 0, 0.25); 
 
} 
 
.navbar.navbar-default .navbar-nav { 
 
    font-size: 0.9em; 
 
} 
 
.navbar .navbar-brand img, 
 
.navbar-nav { 
 
    display: inline; 
 
    text-transform: uppercase; 
 
    height: 50px; 
 
} 
 
.navbar.navbar-default .navbar-nav>li.active>a { 
 
    font-weight: 600; 
 
    text-decoration: underline; 
 
} 
 
.navbar.navbar-default .navbar-nav>li>a:hover, 
 
.navbar.navbar-default .navbar-nav>li>a:focus { 
 
    font-weight: 600; 
 
    background-color: transparent; 
 
    text-decoration: underline; 
 
} 
 
/*===========================================================================================*/ 
 

 
/* Header ------------------------- */ 
 

 
/*=
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> 
 
<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 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> 
 
     </ul> 
 
    </div> 
 
    <!-- /.navbar-collapse --> 
 
    </div> 
 
    <!-- /.container-fluid --> 
 
</nav> 
 
<div class="container"> 
 
    <div class="alert alert-info">Something</div> 
 
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It 
 
    has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
    publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer 
 
    took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset 
 
    sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's 
 
    standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. 
 
    It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the 
 
    printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, 
 
    but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker 
 
    including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled 
 
    it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, 
 
    and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since 
 
    the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in 
 
    the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting 
 
    industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic 
 
    typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem 
 
    Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. 
 
    It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
    publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer 
 
    took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset 
 
    sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's 
 
    standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. 
 
    It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the 
 
    printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, 
 
    but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker 
 
    including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled 
 
    it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, 
 
    and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since 
 
    the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in 
 
    the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> 
 
</div>

+0

Сэр, вы очень помогаете, благодарят, что вы заработали. Удаление высоты: 90 пикселей от Navbar-default заставляли работать, как я хотел, спасибо. – CoffeeNinja

+0

Вы очень приветствуетесь и, пожалуйста, отметьте, что вы отвечаете на вопросы, чтобы другие могли извлечь из этого пользу. – vanburen

0

Заменить этот CSS

nav.mobile_menu { 
background-color: #fff; 
display: none; 
float: left; 
left: -15px; 
overflow: hidden; 
padding: 0 15px; 
position: absolute; 
text-align: left; 
top: 100px; 
width: 100%; 

}

+0

Я попытался добавить это, но он, похоже, не работает. Спасибо за помощь подумал – CoffeeNinja

Смежные вопросы