2016-03-01 50 views
0

我在引導警報部分添加了一個按鈕,表示爲x。可能有超過1行的消息,但x按鈕位於右上角。我需要x按鈕在中間垂直對齊。我想「的風格=」垂直對齊:中間」,但它不是工作的任何幫助表示讚賞感謝asp.net mvc引導對齊按鈕在助推器警報部分中的正確

<div class="alert alert-danger alert-dismissable" role="alert"> 
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true" style="vertical-align: middle">×</button> 
    <div class="row"> 
     <div class="col-sm-12"> 
      <ul style="list-style-type: none"> 
       @{ 
        string[] errorlist = errorMessage.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); 
        foreach (string error in errorlist) 
        { 
         if (!string.IsNullOrEmpty(error)) 
         { 
          <li><i class="glyphicon glyphicon-remove" style="color: #FF0004;"></i> @error</li> 
         } 
        } 
       } 
      </ul> 
     </div> 
    </div> 
</div> 

回答

0

有一個Fiddle例子這是否與申報單

<div class="parentbox"> 
    <div class="childbox"> 
     I shall be in the middle of parentbox regardless of its size! 
    </div> 
</div> 

.parentbox { 
    width:500px; 
    height:400px; 
    border-style:solid; 

    text-align: center; /* align the inline(-block) elements horizontally */ 
    font: 0/0 a;   /* remove the gap between inline(-block) elements */ 
} 

.parentbox:before {  /* create a full-height inline block pseudo-element */ 
    content: ' '; 
    display: inline-block; 
    vertical-align: middle; /* vertical alignment of the inline element */ 
    height: 100%; 
} 

.childbox { 
    display: inline-block; 
    vertical-align: middle;   /* vertical alignment of the inline element */ 
    font: 16px/1 Arial, sans-serif; /* reset the font property */ 

    padding: 5px; 
    border: 2px solid black; 
} 
。。