【问题标题】:I want to reduce the width of one of my flex-items in my navigation bar我想在导航栏中减小我的弹性项目之一的宽度
【发布时间】:2017-07-28 06:04:15
【问题描述】:

如何在不影响其他选项卡的情况下减小我的 levi 链接的宽度?

我想要这样做的原因是,当我点击 levi 和其余链接之间的空间时,它会转到连接到 levi 链接的页面。 levi 链接的宽度太宽。我该如何减少它?

在下图中,levi 跨越了导航栏的大部分区域。我想减少它。

Adjust the width of the preview to see the effect of the css declarations

这是 HTML

<md-whiteframe class = "main-toolbar ">

  <md-theme name = "teal">

      <md-toolbar id = "flex-container">

     <router-link id = "nav" class = "nav-link " :to = " { name: 'levi' }" style = " text-decoration: none;  color: #ffffff; background-color: red; ;         ">levi</router-link>


    <router-link class = "nav-link" :to = "{ name: 'Product' }" style = " text-decoration: none;  color: #ffffff; background-color: yellow;">Using levi</router-link> 

     <router-link  class = "nav-link" :to = "{ name: 'Support' }" style = " text-decoration: none; color: #ffffff; background-color: green;"> Support </router-link>

         <md-button class = "md-raised md-button">

          <router-link id = "navbutton" style = " text-decoration: none; color: #429bf4;" class = "nav-link" :to = "{ name: 'levi' }" > Create Account</router-link>


</md-button>

      </md-toolbar>


  </md-theme>

   </md-whiteframe>

这是 CSS

        position: -webkit-sticky;
        top : 1px;    
        width: 100%;
    }
    #flex-container, #nav {

        font-size: 55px;
        display: flex;
        flex:1;
    }


    #navbutton {
        text-transform: none;
        font-size: 19px !important;
        font-family: Heiti SC;
    }

    .nav-link {
/*        display: inline;*/
        font-family: Helvetica neue;
        cursor: pointer;
        font-size: 19px;
        padding: 10px;
        font-weight: bolder;
        margin:8px;
    }

    .md-display-2 {
        font-family: Heiti SC;
        font-size: 20px;
    }

    #container > .md-layout {
/*  background-color: #F9FBFB;*/
  min-height: 100px;
  border-color: black;
  align-items: center;
  justify-content: center;
/*  border-style: dotted;*/
  border-width: 1px;
  padding: 8px;
margin-bottom: 100px;
font-family: Heiti SC;

}

    footer {
        margin-top: 100px ;
    }

    .btnsubscribe {
         text-transform: none;
        font-family: Heiti SC;
        font-weight: bolder;
        min-width: 66px !important;
         min-height: 56px !important;
        font-size: 19px !important;
    }

    .md-layout #inputSubscribe {

    margin-left: 09px;
    width: 300px;
    }

    .md-layout h3 {
        padding: 0px;
    }

【问题讨论】:

  • 尝试给出最大宽度

标签: html css vuejs2 vue-material


【解决方案1】:

将您的 router-link 包装在 div 中并按照给定的方式更改 css

<div id="abc" style="text-decoration: none;color: rgb(255, 255, 255);background-color: red;" class="nav-link">
    <router-link id="nav" to="[object Object]">levi</router-link>
</div>

#flex-container, #abc{        
    font-size: 55px;
    display: flex;
    flex:1;
}

也将cursor: pointer 删除为.nav-link 并将其提供给

router-link { cursor: pointer;}

【讨论】:

  • Max-width 指定 levi 链接的最大值时将所有链接向左拖动。
  • 抱歉,我把你的问题弄错了'不影响其他标签?'
  • 所以你想增加其他链接的宽度?
  • 没有。我想减小 levi 链接的宽度,因为当我点击 levi 链接和其他链接之间的空间时,它会将我引导到主页。这可能会让用户感到恼火。我希望 levi 链接的点击区域更小
猜你喜欢
  • 2019-02-08
  • 1970-01-01
  • 1970-01-01
  • 2021-04-06
  • 1970-01-01
  • 2016-08-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多