亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

求大神幫我查錯!感謝

我是按照老師一步步來的。可是發現兩個問題:1,遮罩層很小,而且偏左上。2,border無法實現過度旋轉效果。求大神幫我改改。

<!DOCTYPE html>

<html>

<head>

? ? <meta charset=utf-8>

? ? <meta name=description content="css3">

? ? <meta name=viewport content="width=device-width, initial-scale=1">

<title>css3 hover</title>

<style type="text/css">

? ? ? ?.demo,.img,.border{

? ? ? ? width:300px;

? ? ? ? height:300px;

? ? ? ? border-radius:50%;

? ? ? ?}

? ? ? ?.demo{

? ? ? ? position: relative;

? ? ? ? display: block;

? ? ? ?}

? ? ? ? .img{

? ? ? ? background-size: cover;

? ? ? ? background-position: 50% 50%;

? ? ? ? }

? ? ? ? .mask,.border{

? ? ? ? position: absolute;

? ? ? ? left:0;

? ? ? ? top:0;

? ? ? ? }

? ? ? ? .mask{

? ? ? ? ? ? ?text-align: center;

? ? ? ? ? ? ?color:rgba(255,255,255,0);

? ? ? ? ? ? ?border-radius: 50%;

? ? ? ? ? ? -webkit-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? -moz-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? ?-ms-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? ? -o-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? ? ? ?transform: all 0.5s ease-in;

? ? ? ? ? ??

? ? ? ? }

? ? ? ? .info{

? ? ? ? margin-top: 50%;

? ? ? ? -webkit-transform: translateX(25%);

? ? ? ? ? -moz-transform: translateX(25%);

? ? ? ? ? ?-ms-transform: translateX(25%);

? ? ? ? ? ? -o-transform: translateX(25%);

? ? ? ? ? ? ? ?transform: translateX(25%);

? ? ? ? }

? ? ? ? .border{

? ? ? ? border:10px solid #072256;

? ? ? ? border-left-color: #e07514;

? ? ? ? border-top-color:#e07514;

? ? ? ? box-sizing: border-box;

? ? ? ? -webkit-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? -moz-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? ?-ms-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? ? -o-transform: all 0.5s ease-in;

? ? ? ? ? ? ? ? ? ? ?transform: all 0.5s ease-in;

? ? ? ? }

? ? ? ? .demo:hover .mask{

background-color:rgba(0,0,0,0.5);

color:rgba(255,255,255,1);

}

.demo:hover .border{

-webkit-transform:rotate(180deg);

transform:rotate(180deg);


}

</style>

</head>

<body>

? ? <a href="#" class="demo">

? ? <div class="img" style="background-image: url(http://f10.topitme.com/o/201101/26/12960352758915.jpg)"></div>

? ? <div class="mask">

? ? <div class="info">

? ? <h3>beautiful day</h3>

? ? <p>description goes here</p>

? ? </div>

? ? </div>

? ? <div class="border"></div>

? ? </a>


</body>

</html>


正在回答

2 回答

樓上的沒用啊

0 回復 有任何疑惑可以回復我~

改了下你的代碼,關鍵點定位,變形。

<!DOCTYPE?html>
<html>
<head>
????<meta?charset="UTF-8">
????<title>css3?Hover</title>
????<style?type="text/css">
????????.demo,.img,.border,.mask{
????????????width:?300px;
????????????height:?300px;
????????????border-radius:?50%;
????????}
????????
????????.demo{
????????????display:?block;
????????????position:?relative;
????????}
????????.img{
?????????????background-size:?cover;
????????????background-position:?50%?50%;
????????}
????????.border{
????????????border:?10px?solid?#072256;
????????????border-left-color:#E07514;
????????????border-top-color:#E07514;
????????????-webkit-box-sizing:border-box;
????????????box-sizing:border-box;
????????}
????????.mask{
????????????color:rgba(255,255,255,0);
????????}
????????.border,.mask{
????????????position:?absolute;top:?0;?left:?0;?
????????????-webkit-transition:all?.5s?ease-in;
????????????transition:all?.5s?ease-in;
????????}
????????.demo:hover?.mask{
????????????background-color:rgba(0,0,0,0.5);
????????????color:rgba(255,255,255,1);
????????}
????????.demo:hover?.border{
????????????-webkit-transform:rotate(180deg);
????????????transform:rotate(180deg);

????????}
????????.info{
????????????position:?absolute;
????????????width:?100%;
????????????top:?50%;
????????????left:?0;
????????????text-align:?center;
????????????-webkit-transform:translateY(-50%);
????????}

????</style>

</head>
<body>
????<a?href="#">
????????<div?style="background-image:url(http://f10.topitme.com/o/201101/26/12960352758915.jpg)"></div>
????????<div>
????????????<div>
????????????????<h3>beautiful?day</h3>
????????????????<p>description?goes?here</p>
????????????</div>
????????</div>
????????<div></div>
????</a>
</body>
</html>


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
CSS動畫實用技巧
  • 參與學習       79005    人
  • 解答問題       90    個

本CSS教程教你使用CSS實現驚艷的動畫效果,一起去領略一番

進入課程

求大神幫我查錯!感謝

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號