简体   繁体   English

如何使该点与文本的基线垂直对齐?

[英]How can I vertically align this dot with my text's base line?

I applied material design. 我应用了材料设计。 The goal is to create two textfields with a dot in between. 目的是创建两个文本字段,中间插入一个点。 The problem is that the dot is not aligned vertically at the bottom, but somewhere in the center. 问题在于该点不在底部垂直排列,而是在中心某处。 How can I get the dot vertical aligned at the bottom? 如何使点在底部垂直对齐?

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div layout="row"> <md-input-container> <label>Amount Paid</label> <input ng-model="vm.amount1" ng-change="vm.amountChange()" required md-no-float="true" md-maxlength="6" type="text" name="amount"> </md-input-container> <md-text-float> <label>.</label> </md-text-float> <md-input-container> <label>Cents</label> <input ng-model="vm.amount2" ng-change="vm.amountChange()" required md-no-float="true" md-maxlength="2" type="text" name="amount"> </md-input-container> </div> 

在此处输入图片说明

And how can I get the second textbox smaller (such that it only displays 2 characters)? 以及如何缩小第二个文本框(使其仅显示2个字符)?

how can I get the second textbox smaller (such that it only displays 2 characters)? 如何缩小第二个文本框的大小(使其仅显示2个字符)?

adding width property: 增加width属性:

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div layout="row"> <md-input-container> <label>Amount Paid</label> <input ng-model="vm.amount1" ng-change="vm.amountChange()" required md-no-float="true" md-maxlength="6" type="text" name="amount"> </md-input-container> <md-text-float> <label>.</label> </md-text-float> <md-input-container> <label>Cents</label> <input style='width:30px' ng-model="vm.amount2" ng-change="vm.amountChange()" required md-no-float="true" md-maxlength="2" type="text" name="amount"> </md-input-container> </div> 

First div: <div layout="row" layout-align="none end"> 第一div: <div layout="row" layout-align="none end">

This is how you align items using material design. 这就是使用材料设计对齐项目的方式。 First is horizontal and second vertical alignment. 首先是水平对齐,第二个是垂直对齐。 They are switched if layout="column" . 如果layout="column"切换它们。

For more alignment options use the official documentation, it is easy to understand: https://material.angularjs.org/latest/layout/alignment 有关更多对齐选项的信息,请使用官方文档,这很容易理解: https : //material.angularjs.org/latest/layout/alignment

But it will not position the dot where you want it either. 但是它也不会将圆点放置在您想要的位置。 You have to style the label (you should not use label by the way, it is not label of anything). 您必须设置标签样式(顺便说一句,您不应该使用标签,它不是任何标签)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM