在 Vuetify 中将文本对齐到文本字段的中心

新手上路,请多包涵

我有一个显示字符串的只读文本字段。字符串应该从文本字段的左侧开始。我想知道 Vuetify 中是否有办法将字符串与文本字段的中心对齐?

更新 这是我的代码:

 <v-text-field
  value="Select the configuration:"
  color="grey lighten-43"
  class="text--darken-3 mt-3 text-xs-center"
  outline
  readonly
  single-line
></v-text-field>

原文由 mha 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 959
1 个回答

如果您使用范围样式,则必须使用输入字段的深度选择器(即 >>> ):

 <v-text-field
  class="centered-input text--darken-3 mt-3"
  value="Select the configuration:"
  color="grey lighten-43"
  outline readonly single-line />

 <style scoped>
    .centered-input >>> input {
      text-align: center
    }
</style>

原文由 samwise 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题