div get shrinked when using postion: fixed

前端 未结 3 950
情歌与酒
情歌与酒 2021-01-28 02:14

I\'m having a

and I want to make it\'s position: fixed. I\'ve added CSS rule position:fixed but after adding that the
相关标签:
3条回答
  • 2021-01-28 02:34

    In that case, you should define the width of your <div> whose position is fixed. Let's say for example:

    .div {
       width: 80%; // or whatever you want to be the size
    }
    
    0 讨论(0)
  • 2021-01-28 02:39

    May be other div or element of Html make effect on the Div. thats why your div gets shrinked. and secondly please add your css code here then after i can resolve your problem hopefully.

    0 讨论(0)
  • 2021-01-28 02:48

    Use width:100%; for that div.

    <div layout="row" style="background-color:#1CA5EA; position:fixed; width:100%;">
    
        <div offset="25" flex="30" class="input-container">
           <md-input-container flex >
              <label style="color:white">Search</label>
              <input ng-model="search" style="border-bottom:2px solid white;color:white;">
           </md-input-container>
        </div>
    
        <div flex="10" class="input-container">
           <button class="primary-button md-button md-default-theme">
             <span class="ng-scope" ui-sref="company.addRecruitmentProject">
               + JOB AD
             </span>
           </button>
        </div>
    
     </div>
    

    Demo here

    0 讨论(0)
提交回复
热议问题