首页
\
问答
\
为什么我的常规导航栏覆盖标题,而折叠的标题没有?(Why does my regular navbar cover header while the collapsed one does not? (bootstrap/fullpage))
为什么我的常规导航栏覆盖标题,而折叠的标题没有?(Why does my regular navbar cover header while the collapsed one does not? (bootstrap/fullpage))
我的导航栏覆盖了我的标题而不是相对于标题高度位于下方,我遇到了一些问题。 当我使用一个较小的屏幕并且导航栏过去折叠时它的位置就像它应该的那样,为什么会这样?
main { position: relative; background-image: url(asdasdads-321-redigerad-2.jpg); top: 0; width: 100%; height: 100%; background-color: white; background-repeat: no-repeat; background-position: bottom; background-size: cover; } header { width: 100%; height: 100px; position: fixed; top: 0; } .container { position: relative; } .navbar-fixed-top { position: relative; } .navbar-default { position: relative; width: 100%; background-color: rgba(255, 255, 255, 0); border-bottom: 3px solid rgba(51, 51, 51, 0); }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <header> <h1>header</h1> <p>asdf asdas dasdadf dgfsd sdf asf fsdfsdf sdfa sfasf df</p> </header> <nav class="navbar-default" role="navigation"> <div class="container"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-container"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="collapse navbar-collapse" id="navbar-container"> <ul id="menu"> <li><a href="#firstPage" title="Ab knapp" id="Ab-logo">UPPDRAG</a></li> <li data-menuanchor="secondPage" id="filosofi"><a href="#secondPage">FILOSOFI</a></li> <li data-menuanchor="thirdPage" id="uppdrag"><a href="#thirdPage">UPPDRAG</a></li> <li data-menuanchor="4thpage" id="karriär"><a href="#4thpage">KARRIÄR</a></li> <li data-menuanchor="5thpage" id="academy"><a href="#5thpage">ACADEMY</a></li> <li data-menuanchor="lastPage" id="kontakt"><a href="#lastPage">KONTAKT</a></li> </ul> </div> </div> </nav>
I have some problems with my navbar covering my header instead of positioning below relative to the header height. When i use a smaller screen and the navbar goes over to collapse it positions below like it should, how come?
main { position: relative; background-image: url(asdasdads-321-redigerad-2.jpg); top: 0; width: 100%; height: 100%; background-color: white; background-repeat: no-repeat; background-position: bottom; background-size: cover; } header { width: 100%; height: 100px; position: fixed; top: 0; } .container { position: relative; } .navbar-fixed-top { position: relative; } .navbar-default { position: relative; width: 100%; background-color: rgba(255, 255, 255, 0); border-bottom: 3px solid rgba(51, 51, 51, 0); }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <header> <h1>header</h1> <p>asdf asdas dasdadf dgfsd sdf asf fsdfsdf sdfa sfasf df</p> </header> <nav class="navbar-default" role="navigation"> <div class="container"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-container"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="collapse navbar-collapse" id="navbar-container"> <ul id="menu"> <li><a href="#firstPage" title="Ab knapp" id="Ab-logo">UPPDRAG</a></li> <li data-menuanchor="secondPage" id="filosofi"><a href="#secondPage">FILOSOFI</a></li> <li data-menuanchor="thirdPage" id="uppdrag"><a href="#thirdPage">UPPDRAG</a></li> <li data-menuanchor="4thpage" id="karriär"><a href="#4thpage">KARRIÄR</a></li> <li data-menuanchor="5thpage" id="academy"><a href="#5thpage">ACADEMY</a></li> <li data-menuanchor="lastPage" id="kontakt"><a href="#lastPage">KONTAKT</a></li> </ul> </div> </div> </nav>
原文:https://stackoverflow.com/questions/36056844
更新时间:2023-08-12 08:08
最满意答案
使用以下css对齐square :
h1{ position:relative; } .square-stop { font-size: 0.7em; position: absolute; bottom: 0; }
I was using the font Myriad Pro which was causing this problem in Chrome, I fixed this but setting the .square-stop font as Arial.
You can view my fix here: http://jsfiddle.net/9a8x844n/3/
.square-stop {font-size: 0.7em; font-family: Arial;}
相关问答
更多-
#father { position: relative; } #son1 { position: absolute; top: 0; } #son2 { position: absolute; bottom: 0; } 这是因为position: absolute意味着像“使用top , right , bottom , left与自己位于与position: absolute或position: relative的最近的祖先position: relative 。 所 ...
-
使用CSS将HTML元素相对于父元素的底部定位?(Position HTML element relative to bottom of parent element using CSS?)[2022-02-15]
工作得很好 section { position: relative; } .contentbox, #proclaim { bottom: 10px; // your value position: absolute; } works just fine section { position: relative; } .contentbox, #proclaim { bottom: 10px; // your value position: absolute; } -
你需要position: relative标题上的position: relative 。 没有它,它就不会像它是一个子元素。 没有relative它的行为就像它只是在body而不是在父元素中: * { font-family: Arial, sans-serif; border: 0 solid black; box-sizing: border-box; } body { margin: 0; padding: 0; height: 5 ...
-
使用以下css对齐square : h1{ position:relative; } .square-stop { font-size: 0.7em; position: absolute; bottom: 0; } I was using the font Myriad Pro which was causing this problem in Chrome, I fixed this but setting the .square-stop font as A ...
-
获取其容器的x和y位置,并从适当的值中扣除这些值。 jsFiddle 。 或者,给可拖动元素的position: absolute和父position: relative 。 jsFiddle 。 Take the x and y position of its container and deduct those values from the appropriate values. jsFiddle. Alternatively, give the draggable element's positio ...
-
您可以将margin-top: auto和width: 100%赋予子元素: .parent { width: 500px; height: 250px; background-color: gray; padding: 10px; display: flex; } .child { height: 50px; text-align: right; margin-top: auto; width: 100%; }如果你需要使用div而不是表来执行此操作,可以使用css for display:table来使div像表一样响应: HTMLTextLong text wrapped over multiple lines
如何使用相对父位置将页脚绑定到页面底部?(How to bound a footer to the page bottom with relative parent position?)[2023-04-30]
你需要将这个css代码添加到页脚 footer{ position: absolute; bottom: 0; width: 100%; } 这将使页脚位于第一个父项的底部,其相对位置在这种情况下是容器div you need to add this css code to the footer footer{ position: absolute; bottom: 0; width: 100%; } this will position the foot ...你可以这样做: 删除position: relative .blabla 设置position: absolute .wrapper , .parent和.child 。 .wrapper { position: absolute; width: 1280px; } .parent { position: absolute; } .child { position: absolute; width: 960px; } .blabla { overflow: h ...使宽度不相对于父级(Make width not relative to parent)[2023-08-03]
看一下频谱文档。 您可以使用“appendTo”属性来更改颜色选择器相对于哪个元素。 $("#droppable").spectrum({ appendTo: "body", showPalette: true, showSelectionPalette: true, }); 这将创建您可能正在寻找的并排视图。 由于您希望颜色选择器使用包装器拖动并相对定位,因此请在绑定到频谱处理程序的元素上尝试以下样式规则:相关文章
更多- SOAP Header 元素详解
- BootStrap入门教程 (三)
- BootStrap入门教程 (四)
- 项目移到linux环境下时tomcat报错 java.util.zip.ZipException: invalid END header
- 【原创】小白学jquery Mobile《构建跨平台APP:jQuery Mobile移动应用实战》连载五(给按钮加图标)
- HttpClient 请求添加Header头部信息
- windows phone开发中textbox控件的header属性
- extjs 读到的json只显示header 可能是什么原因?
- BootStrap入门教程 (二)
- 左则导航鼠标滑过时显示详情的实现
最新问答
更多- 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
- Java中的不可变类(Immutable class in Java)
- 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
- linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
- Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
- 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
- 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
- Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
- EXCEL VBA 基础教程下载
- RoR - 邮件中的动态主体(部分)(RoR - Dynamic body (part) in mailer)
- 无法在Google Script中返回2D数组?(Can not return 2D Array in Google Script?)
- JAVA环境变量的设置和对path , classpth ,java_home设置作用和目的?
- mysql 关于分组查询、时间条件查询
- 如何使用PowerShell匹配运算符(How to use the PowerShell match operator)
- Effective C ++,第三版:重载const函数(Effective C++, Third edition: Overloading const function)
- 如何用DELPHI动态建立MYSQL的数据库和表? 请示出源代码。谢谢!
- 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
- 使用前端框架带来哪些好处,相对于使用jquery
- Ruby将字符串($ 100.99)转换为float或BigDecimal(Ruby convert string ($100.99) to float or BigDecimal)
- 高考完可以去做些什么?注意什么?
- 如何声明放在main之后的类模板?(How do I declare a class template that is placed after the main?)
- 如何使用XSLT基于兄弟姐妹对元素进行分组(How to group elements based on their siblings using XSLT)
- 在wordpress中的所有页面的标志(Logo in all pages in wordpress)
- R:使用rollapply对列组进行求和的问题(R: Problems using rollapply to sum groups of columns)
- Allauth不会保存其他字段(Allauth will not save additional fields)
- python中使用sys模块中sys.exit()好像不能退出?
- 将Int拆分为3个字节并返回C语言(Splitting an Int to 3 bytes and back in C)
- 在SD / MMC中启用DDR会导致问题吗?(Enabling DDR in SD/MMC causes problems? CMD 11 gives a response but the voltage switch wont complete)
- sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
- 如何将字符串转换为Elixir中的函数(how to convert a string to a function in Elixir)