CSSだけを使用して、中央から外側ではなく、右から左にグラデーションを使用して境界線の下部を作成できるかどうかを知りたいと思います。
答えを探していたところ、JSFiddleリンクが見つかりました。これは、上から下に透明な境界線のグラデーションを付けることができることを示しています。
方法1 /*背景のグラデーションのみを使用*/
.one {
width: 400px;
padding: 20px 25px;
border-top: 5px solid #000;
margin: 40px auto;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#000), to(transparent));
background-image: -webkit-linear-gradient(#000, transparent);
background-image:
-moz-linear-gradient(#000, transparent),
-moz-linear-gradient(#000, transparent)
;
background-image:
-o-linear-gradient(#000, transparent),
-o-linear-gradient(#000, transparent)
;
background-image:
linear-gradient(#000, transparent),
linear-gradient(#000, transparent)
;
-moz-background-size:5px 100%;
background-size:5px 100%;
background-position:0 0, 100% 0;
background-repeat:no-repeat;
}
方法2 /*疑似要素と背景グラデーションを使用する*/
.two {
position: relative;
width: 400px;
padding: 20px;
border: 5px solid transparent;
border-top-color: #000;
margin: 40px auto;
}
.two:before,
.two:after {
content: "";
position: absolute;
top: -5px;
bottom: -5px;
left: -5px;
width: 5px;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#000), to(transparent));
background-image: -webkit-linear-gradient(#000, transparent);
background-image: -moz-linear-gradient(#000, transparent);
background-image: -o-linear-gradient(#000, transparent);
background-image: linear-gradient(#000, transparent);
}
.two:after {
left: auto;
right: -5px;
}
上記のCSSがどのようにページに方向を知らせているのか理解できません。これはほんの少しの単純で見過ごされている編集であると思いますが、現時点では見つけることができないようです。したがって、この質問をします。助けを求めるために。
境界線が破線または点線の場合にこれが機能するかどうかも知りたいですか?
事前のヘルプやアドバイスをありがとうございます。
よろしく、ティム