使用 CSS 在标签文本右侧显示星号 (*)
Showing asterisk (*) symbol to the right of label text using CSS
我想使用 CSS 在标签文本的正确位置显示星号,但在 vaadin 8.6.2
中无法成功
.v-label-wrap {
content: " *";
color: red;
position: absolute;
white-space: normal !important;
word-break: normal !important;
word-wrap: normal !important;
}
Label lblAttr = new Label("Name");
lblAttr.addStyleName("wrap");
需要显示红色星号*。请指教如何解决这个问题
像这样使用 ::after
:
.v-label-wrap::after {
content: "*";
color: red;
}
有关之后的更多信息:MDN ::after/:after
It is often used to add cosmetic content to an element with the content property. It is inline by default.
我想使用 CSS 在标签文本的正确位置显示星号,但在 vaadin 8.6.2
中无法成功.v-label-wrap {
content: " *";
color: red;
position: absolute;
white-space: normal !important;
word-break: normal !important;
word-wrap: normal !important;
}
Label lblAttr = new Label("Name");
lblAttr.addStyleName("wrap");
需要显示红色星号*。请指教如何解决这个问题
像这样使用 ::after
:
.v-label-wrap::after {
content: "*";
color: red;
}
有关之后的更多信息:MDN ::after/:after
It is often used to add cosmetic content to an element with the content property. It is inline by default.