当前位置: 首页 > 知识库问答 >
问题:

我如何去去除我的固定底部导航条的缝隙

乜业
2023-03-14

我试图改变菜单的外观,将链接移动到与社交媒体图标和主页按钮相同的行上。

链接在主navbar类(Streetwear-Demos)下的div中,社交媒体图标和主页也在自己的div中浮动到他们尊敬的一边。我试着改变navbar类的宽度,以为它会加入,但它只是改变了链接的定位。

我如何使它使每个社交媒体的链接和图标在同一条线上,居中?

null

@import url(http://fonts.googleapis.com/css?family=Raleway:300,400,700);

*,
*:after,
*:before {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.clearfix:before,
.clearfix:after {
  content: '';
  display: table;
}

.clearfix:after {
  clear: both;
}

body {
  background: #333;
  color: #fff;
  font-size: 16px;
  font-family: 'Raleway', Arial, sans-serif;
}

a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  outline: none;
}


/* Link Colours */

.fade {
  background: #333;
}

.fade a {
  color: #fff;
}

a:hover,
a:focus {
  color: #333;
}

.social {
  float: left;
  clear: none;
}

#social {
  padding: 5px;
}


/* Buttons */

.Streetworn-demos {
  width: 100vw;
  background-color: #ff9966;
  margin: 0;
  text-align: center;
  position: fixed;
  bottom: 0;
}

.Streetworn-demos a {
  text-align: center;
  display: inline-block;
  margin: 0.5em 0.75em;
  line-height: 1;
  font-family: 'Raleway', cursive;
  letter-spacing: 1px;
}

.about h3 {
  font-family: 'Satisfy', cursive;
  font-size: 32px;
  margin: 5px;
  padding-top: 6px;
  padding-left: 10px;
  border-radius: 5px 25px 25px 5px;
  background-color: #ff9966;
}

.about p {
  font-family: 'Raleway', cursive;
  font-weight: 700;
  font-size: 16px;
  padding: 10px;
  margin: auto;
}

.login {
  width: 100%;
  margin: auto;
  text-align: right;
  padding: 10px;
  background: #ff9966;
}

#home {
  padding: 5px;
}

.homepage {
  float: right;
  clear: none;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
  display: block;
}

audio,
canvas,
video {
  display: inline-block;
}

audio:not([controls]) {
  display: none;
  height: 0;
}

[hidden] {
  display: none;
}

html {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
}

a:focus {
  outline: thin dotted;
}

a:active,
a:hover {
  outline: 0;
}

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

abbr[title] {
  border-bottom: 1px dotted;
}

b,
strong {
  font-weight: bold;
}

dfn {
  font-style: italic;
}

hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  height: 0;
}

mark {
  background: #ff0;
  color: #000;
}

code,
kbd,
pre,
samp {
  font-family: monospace, serif;
  font-size: 1em;
}

pre {
  white-space: pre-wrap;
}

q {
  quotes: "\201C" "\201D" "\2018" "\2019";
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

img {
  border: 0;
}

svg:not(:root) {
  overflow: hidden;
}

figure {
  margin: 0;
}

fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}

legend {
  border: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  margin: 0;
}

button,
input {
  line-height: normal;
}

button,
select {
  text-transform: none;
}

button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button[disabled],
html input[disabled] {
  cursor: default;
}

input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  padding: 0;
}

input[type="search"] {
  -webkit-appearance: textfield;
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box;
  box-sizing: content-box;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

textarea {
  overflow: auto;
  vertical-align: top;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}
<div class="login">
  <a class="loginlink" href="#">Login / Signup</a>
</div>

<nav class="Streetworn-demos">
  <div class="navbar">
    <a class="brands" href="#">PALACE</a>
    <a class="brands" href="#">GOLFWANG</a>
    <a class="brands" href="#">SUPREME</a>
    <a class="brands" href="#">BILLIONAIRE'S BOYS CLUB</a>
    <a class="brands" href="#">STUSSY</a>
    <a class="brands" href="#">ANTISOCIAL SOCIAL CLUB</a>
  </div>
  <div class="homepage">
    <a class="home" href="index.html"><img id="home" alt="Return to the landing page" src="https://image.ibb.co/fnApE7/home2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/bwSEgn/homeicon.png'" onmouseout="this.src='https://image.ibb.co/fnApE7/home2.png'"></a>
  </div>
  <div class="social">
    <a href="http://www.facebook.com/"><img id="social" alt="Follow Streetworn on Facebook!" src="https://image.ibb.co/ftLBSS/fb2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/ktUS1n/fbicon.png'" onmouseout="this.src='https://image.ibb.co/ftLBSS/fb2.png'"></a>
    <a href="http://www.instagram.com/"><img id="social" alt="Follow Streetworn on Instagram!" src="https://image.ibb.co/fDPugn/ig2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/e5o9E7/igicon.png'" onmouseout="this.src='https://image.ibb.co/fDPugn/ig2.png'"></a>
    <a href="http://www.twitter.com/"><img id="social" alt="Follow Streetworn on Twitter!" src="https://image.ibb.co/cK5Zgn/twitter2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/eGbJ7S/twittericon.png'" onmouseout="this.src='https://image.ibb.co/cK5Zgn/twitter2.png'"></a>
  </div>
</nav>

null

任何帮助都将不胜感激!

共有1个答案

宣冥夜
2023-03-14

由于您使用的是浮点,所以最简单的做法是将主页和社交div重新排序到navbar div之前,这样它们就会首先浮点,而navbar会占据它们之间的空间:

null

@import url(http://fonts.googleapis.com/css?family=Raleway:300,400,700);
*,
*:after,
*:before {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.clearfix:before,
.clearfix:after {
  content: '';
  display: table;
}

.clearfix:after {
  clear: both;
}

body {
  background: #333;
  color: #fff;
  font-size: 16px;
  font-family: 'Raleway', Arial, sans-serif;
}

a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  outline: none;
}


/* Link Colours */

.fade {
  background: #333;
}

.fade a {
  color: #fff;
}

a:hover,
a:focus {
  color: #333;
}

.social {
  float: left;
  clear: none;
}

#social {
  padding: 5px;
}


/* Buttons */

.Streetworn-demos {
  width: 100vw;
  background-color: #ff9966;
  margin: 0;
  text-align: center;
  position: fixed;
  bottom: 0;
}

.Streetworn-demos a {
  text-align: center;
  display: inline-block;
  margin: 0.5em 0.75em;
  line-height: 1;
  font-family: 'Raleway', cursive;
  letter-spacing: 1px;
}

.about h3 {
  font-family: 'Satisfy', cursive;
  font-size: 32px;
  margin: 5px;
  padding-top: 6px;
  padding-left: 10px;
  border-radius: 5px 25px 25px 5px;
  background-color: #ff9966;
}

.about p {
  font-family: 'Raleway', cursive;
  font-weight: 700;
  font-size: 16px;
  padding: 10px;
  margin: auto;
}

.login {
  width: 100%;
  margin: auto;
  text-align: right;
  padding: 10px;
  background: #ff9966;
}

#home {
  padding: 5px;
}

.homepage {
  float: right;
  clear: none;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
  display: block;
}

audio,
canvas,
video {
  display: inline-block;
}

audio:not([controls]) {
  display: none;
  height: 0;
}

[hidden] {
  display: none;
}

html {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
}

a:focus {
  outline: thin dotted;
}

a:active,
a:hover {
  outline: 0;
}

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

abbr[title] {
  border-bottom: 1px dotted;
}

b,
strong {
  font-weight: bold;
}

dfn {
  font-style: italic;
}

hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  height: 0;
}

mark {
  background: #ff0;
  color: #000;
}

code,
kbd,
pre,
samp {
  font-family: monospace, serif;
  font-size: 1em;
}

pre {
  white-space: pre-wrap;
}

q {
  quotes: "\201C" "\201D" "\2018" "\2019";
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

img {
  border: 0;
}

svg:not(:root) {
  overflow: hidden;
}

figure {
  margin: 0;
}

fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}

legend {
  border: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  margin: 0;
}

button,
input {
  line-height: normal;
}

button,
select {
  text-transform: none;
}

button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button[disabled],
html input[disabled] {
  cursor: default;
}

input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  padding: 0;
}

input[type="search"] {
  -webkit-appearance: textfield;
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box;
  box-sizing: content-box;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

textarea {
  overflow: auto;
  vertical-align: top;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}
html lang-html prettyprint-override"><div class="login">
  <a class="loginlink" href="#">Login / Signup</a>
</div>

<nav class="Streetworn-demos">
  <div class="homepage">
    <a class="home" href="index.html"><img id="home" alt="Return to the landing page" src="https://image.ibb.co/fnApE7/home2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/bwSEgn/homeicon.png'" onmouseout="this.src='https://image.ibb.co/fnApE7/home2.png'"></a>
  </div>
  <div class="social">
    <a href="http://www.facebook.com/"><img id="social" alt="Follow Streetworn on Facebook!" src="https://image.ibb.co/ftLBSS/fb2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/ktUS1n/fbicon.png'" onmouseout="this.src='https://image.ibb.co/ftLBSS/fb2.png'"></a>
    <a href="http://www.instagram.com/"><img id="social" alt="Follow Streetworn on Instagram!" src="https://image.ibb.co/fDPugn/ig2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/e5o9E7/igicon.png'" onmouseout="this.src='https://image.ibb.co/fDPugn/ig2.png'"></a>
    <a href="http://www.twitter.com/"><img id="social" alt="Follow Streetworn on Twitter!" src="https://image.ibb.co/cK5Zgn/twitter2.png" style="height: 36px; width: 36px" onmouseover="this.src='https://image.ibb.co/eGbJ7S/twittericon.png'" onmouseout="this.src='https://image.ibb.co/cK5Zgn/twitter2.png'"></a>
  </div>
  <div class="navbar">
    <a class="brands" href="#">PALACE</a>
    <a class="brands" href="#">GOLFWANG</a>
    <a class="brands" href="#">SUPREME</a>
    <a class="brands" href="#">BILLIONAIRE'S BOYS CLUB</a>
    <a class="brands" href="#">STUSSY</a>
    <a class="brands" href="#">ANTISOCIAL SOCIAL CLUB</a>
  </div>

</nav>
 类似资料:
  • 我用‘固定’使‘导航’不动。然而,如果有一个“标题”,则有一个与“标题”区域一样多的边距。在向上移动了多少‘头部’区域后,我想把它固定在那个位置。我在用“反应”所以很难找到方法。我正在自学,所以我原来知道的不多,所以我来学习一些新的东西。 null null

  • 我是新手。我正在努力实现这个用户界面 我还没有找到任何使用完整的解决方案来创建颤振中的透明底部导航栏。 我试过用 但这似乎行不通。请帮忙。

  • 实现tabbar建议采用小程序原生的tabbar,通过设置page/main.js(即对应小程序中app.json)来实现,详情请看小程序文档。示例如下,仅作参考: tabBar: { color: '#999999', selectedColor: '#1AAD16', backgroundColor: '#ffffff', borderStyle: 'white', /*

  • 我在我的项目中实现了Design Support Library 25中的底部导航视图。我在视图中有5个图标。每当选择一个图标时,它都会有一些动画。但当3个或更少的图标未显示任何动画时。我想删除该动画,只需要对图标进行一些颜色更改。我怎样才能做到这一点?做了足够多的谷歌搜索,但找不到解决方案。请帮忙。谢谢

  • 本文向大家介绍iOS如何去掉导航栏(UINavigationBar)下方的横线,包括了iOS如何去掉导航栏(UINavigationBar)下方的横线的使用技巧和注意事项,需要的朋友参考一下 网上有很多关于隐藏的方法,设置后能够成功,但是跳转到其他界面的时候发现,其他界面横线也被隐藏了。 目前主流的方法是将shadowImage用一张空的图片图片替换掉 可是这种方法不能解决navigationCo

  • 我有一个关于底部导航栏的奇怪问题,虽然我花了大量时间在它上面,但我无法解决。当我以“推荐”的方式(从许多教程中)使用它时,它就是无法导航。 那么,我所说的“推荐”方式是什么意思呢:我有一个单独的acticity,其中有一个名为“MainActivity”的navHostFragment。这个主要活动有一个XML布局文件,我将底部导航栏放在其中。BottomNavigationBar还有一个XML布