teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2019/01/22 02:58

投稿

akihiro3
akihiro3

スコア955

answer CHANGED
@@ -45,4 +45,54 @@
45
45
  </body>
46
46
  </html>
47
47
 
48
+ ```
49
+ 追記
50
+ ---
51
+ コメントより
52
+ 画像をテキストにとは、こういう事ですか?
53
+ ```html
54
+ <!DOCTYPE html>
55
+ <html lang="ja" dir="ltr">
56
+ <head>
57
+ <meta charset="utf-8">
58
+ <title>sample</title>
59
+ <style media="screen">
60
+ .sample1 {
61
+ width: 280px;
62
+ height: 188px;
63
+ overflow: hidden;
64
+ margin: 10px 8px 10px 16px;
65
+ position: relative; /* 相対位置指定 */
66
+ }
67
+ .sample1 .caption {
68
+ font-size: 130%;
69
+ text-align: center;
70
+ padding-top: 80px;
71
+ color: #fff;
72
+ }
73
+ .sample1 .mask {
74
+ width: 100%;
75
+ height: 100%;
76
+ position: absolute; /* 絶対位置指定 */
77
+ top: 0;
78
+ left: 0;
79
+ opacity: 0; /* マスクを表示しない */
80
+ background-color: rgba(0,0,0,0.4); /* マスクは半透明 */
81
+ -webkit-transition: all 0.2s ease;
82
+ transition: all 0.2s ease;
83
+ }
84
+ .sample1:hover .mask {
85
+ opacity: 1; /* マスクを表示する */
86
+ }
87
+ </style>
88
+ </head>
89
+ <body>
90
+ <div class="sample1">
91
+ <p>text text text text text text text text text text text text text text </p>
92
+ <div class="mask">
93
+ <div class="caption">It's fresh !</div>
94
+ </div>
95
+ </div>
96
+ </body>
97
+ </html>
48
98
  ```