5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CSSで作る必須マーク

Last updated at Posted at 2020-09-13

「*」のマーク

スクリーンショット 2020-09-13 20.43.46.png:arrow_left: でこんな感じになる :arrow_right:スクリーンショット 2020-09-13 20.43.33.png

<!-- classで「required」を付けた文字の後ろに必須マークが出る -->
<h:outputText styleClass="required" value="好きな生き物" />
.required::after {
  content: " *";
  color: red;
  vertical-align: middle;
}

「必須」文字のマーク

スクリーンショット 2020-09-13 20.22.58.png :arrow_left: でこんな感じになる :arrow_right: スクリーンショット 2020-09-13 21.02.24.png

.required::after {
  content: "必須";
  background-color: #f0ad4e;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  min-width: 10px;
  padding: 3px 7px;
  margin: 0px 5px;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
  text-align: center;
  border-radius: 10px;
  display: inline-block;
}
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?