.article-image1 {
height: 256px;
width: 256px;
}
.article-image1:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url(http://limootoys.com/wp-content/uploads/gentleman-e1508436248648.png);
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image1:hover:before {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image1 {
position: relative;
width: 256px;
height: 256px;
top: 0;
right: 0;
}
.article-image1>p {
display: none;
}
.article-image1:hover>p {
position: absolute;
top: 50%;
display: block;
color: #fed700;
text-shadow: 3px 3px #000000;
font-size: 50px;
font-weight: bold;
z-index: 9999999;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
/*puzzle*/
.article-image2 {
height: 256px;
width: 256px;
}
.article-image2:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url(http://limootoys.com/wp-content/uploads/puzzle.png);
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image2:hover:before {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image2 {
position: relative;
width: 256px;
height: 256px;
top: -286px;
right: 306px;
}
.article-image2>p {
display: none;
}
.article-image2:hover>p {
position: absolute;
top: 50%;
display: block;
color: #fed700;
text-shadow: 3px 3px #000000;
font-size: 50px;
font-weight: bold;
z-index: 9999999;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
/*Maket*/
.article-image3 {
height: 256px;
width: 256px;
}
.article-image3:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url(http://limootoys.com/wp-content/uploads/minivan.png);
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image3:hover:before {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image3 {
position: relative;
width: 256px;
height: 256px;
top: -572px;
right: 662px;
}
.article-image3>p {
display: none;
}
.article-image3:hover>p {
position: absolute;
top: 50%;
display: block;
color: #fed700;
text-shadow: 3px 3px #000000;
font-size: 50px;
font-weight: bold;
z-index: 9999999;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
/*figure*/
.article-image4 {
height: 256px;
width: 256px;
}
.article-image4:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url(http://limootoys.com/wp-content/uploads/batman.png);
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image4:hover:before {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image4 {
position: relative;
width: 256px;
height: 256px;
top: -512px;
right: 0px;
}
.article-image4>p {
display: none;
}
.article-image4:hover>p {
position: absolute;
top: 50%;
display: block;
color: #fed700;
text-shadow: 3px 3px #000000;
font-size: 50px;
font-weight: bold;
z-index: 9999999;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
/*toys*/
.article-image5 {
height: 256px;
width: 256px;
}
.article-image5:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url(http://limootoys.com/wp-content/uploads/robot.png);
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image5:hover:before {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image5 {
position: relative;
width: 256px;
height: 256px;
top: -798px;
right: 306px;
}
.article-image5>p {
display: none;
}
.article-image5:hover>p {
position: absolute;
top: 50%;
display: block;
color: #fed700;
text-shadow: 3px 3px #000000;
font-size: 50px;
font-weight: bold;
z-index: 9999999;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
/*entertaimnt*/
.article-image6 {
height: 256px;
width: 256px;
}
.article-image6:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url(http://limootoys.com/wp-content/uploads/magician.png);
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image6:hover:before {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image6 {
position: relative;
width: 256px;
height: 256px;
top: -1084px;
right: 662px;
}
.article-image6>p {
display: none;
}
.article-image6:hover>p {
position: absolute;
top: 50%;
display: block;
color: #fed700;
text-shadow: 3px 3px #000000;
font-size: 50px;
font-weight: bold;
z-index: 9999999;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
<a style="display:block" href="http://limootoys.com/?product_cat=lego">
<div class="ar-image1">
<div class="article-image1">
<p>لگو</p>
</div>
</div>
</a>
<a style="display:block" href="http://limootoys.com/?product_cat=puzzle">
<div class="ar-image2">
<div class="article-image2">
<p>پازل</p>
</div>
</div>
</a>
<a style="display:block" href="http://limootoys.com/?product_cat=maket">
<div class="ar-image3">
<div class="article-image3">
<p>ماکت</p>
</div>
</div>
</a>
<a style="display:block" href="http://limootoys.com/?product_cat=figure">
<div class="ar-image4">
<div class="article-image4">
<p>فیگور</p>
</div>
</div>
</a>
<a style="display:block" href="http://limootoys.com/?product_cat=toys">
<div class="ar-image5">
<div class="article-image5">
<p>اسباب بازی</p>
</div>
</div>
</a>
<a style="display:block" href="http://limootoys.com/?product_cat=entertaiment">
<div class="ar-image6">
<div class="article-image6">
<p>سرگرمی</p>
</div>
</div>
</a>
我想創建一個菜單,我的網站有一些可點擊圖標,但是當我使用上面的代碼中一些不需要的空白空間出現的結束。另外,當我使用手機訪問該頁面時,圖標完全顯示爲網格。您可以檢查my site以查看實際發生的情況。任何幫助消除這些空的空間將不勝感激。
感謝詹姆斯,你是對的,它沒有在移動設備上正確縮放,但是你的代碼已修復! –
阿里沒問題,總是樂於幫忙。看看我剛更新的原版下面的編輯版本。觀察我如何使用文章圖像的類和ID來減少聲明所有圖像圖標中相同屬性的冗餘。另外,儘量避免不惜一切代價使用內聯css,它將在將來進行樣式更改時幫助您,這樣您就不必使用!important或返回到您的html以獲得所需的更改。快樂編碼我的朋友! – jstoobz
多麼美麗的一段代碼!謝謝。我在編碼方面很努力,所以你的解釋非常有幫助!我會記住他們。 –