简体   繁体   English

使用 html/css/flexbox 样式错误消息

[英]Styling error messages with html/css/flexbox

I like would to implement error messages for the password field as the following below pic shows.我想为密码字段实现错误消息,如下图所示。

Could anyone please tell me what is the best/clean way to achieve the following view, with HTML/css and flexbox?谁能告诉我使用 HTML/css 和 flexbox 实现以下视图的最佳/干净方法是什么?

在此处输入图片说明

I know I should say 'show what you've tried' but I'm keen to see how other people would solve this.我知道我应该说“展示你已经尝试过的东西”,但我很想知道其他人会如何解决这个问题。

The solution I've given below is über basic (it doesn't take care of long string values if they overflow; it could be better and update flex-direction to column for .row using a media query for small viewports).我在下面给出的解决方案是超级基本的(如果它们溢出,它不会处理长字符串值;它可能会更好,并使用小视口的媒体查询将flex-direction更新为.row column )。

Just as an aside, I'd highly recommend using the fxLayout library with Angular.顺便说一句,我强烈建议在 Angular 中使用fxLayout库。

<div>
  <div class="row">
    <div class="cell">content 01</div>
    <div class="cell">content 02</div>
  </div>
  <div class="row">
    <div class="cell">content 03</div>
    <div class="cell">content 04</div>
  </div>
</div>
  
div.row {
  display: flex;
  flex-direction: row;
}

div.cell {
  display: flex;
  width: 50%;
}

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

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