text-align无法处理chrome上的select控件

时间:2017-07-20 13:00:08

标签: html css google-chrome firefox

我已经解决了我的问题。中心在firefox中运行,但不在chrome中。有什么想法吗?

.center_align
{
  text-align: center;
  width: 100%;
}
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
    <select class="form-control center_align">
        <option value="0">   - Välj -</option>
        <option value="1" selected="">   Kategorier valda</option>
     </select>

</body>
</html>

1 个答案:

答案 0 :(得分:4)

使用text-align-last:center;

.center_align {
  text-align:center;
  width: 100%;
  text-align-last:center;<----------Added
}

.center_align {
  text-align:center;
  width: 100%;
  text-align-last:center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<select class="form-control center_align">
  <option value="0">   - Välj -</option>
  <option value="1" selected="">   Kategorier valda</option>
</select>