友情链接 🥰#
<div class="friend-links-row">
<div class="friend-item">
<img src="圖片地址A" alt="博客A" />
<div>
<strong>
<a href="https://www.xxx.com/" target="_blank" rel="noopener noreferrer">@博客名稱</a>
</strong>
<div>博客簡介OZR</div>
</div>
</div>
<div class="friend-item">
<img src="圖片地址B" alt="博客A" />
<div>
<strong>
<a href="https://www.xxx.com/" target="_blank" rel="noopener noreferrer">@博客名稱</a>
</strong>
<div>博客簡介OZR</div>
</div>
</div>
<div class="friend-item">
<img src="圖片地址C" alt="博客C" />
<div>
<strong>
<a href="https://www.xxx.com/" target="_blank" rel="noopener noreferrer">@博客名稱</a>
</strong>
<div>博客簡介OZR</div>
</div>
</div>
</div>
<!-- 另外起一行可以直接複製這整個代碼塊 -->
另外加入 CSS:
.friend-links-row {
display: flex;
flex-wrap: wrap; /* 允許換行 */
justify-content: center; /* 居中顯示 */
gap: 24px 16px; /* 行間距、列間距 */
margin-bottom: 30px;
}
.friend-item {
display: flex;
flex-direction: column;
align-items: center;
width: 220px; /* 預設寬度,適合大部分螢幕 */
background: #fff;
border-radius: 16px;
padding: 20px 12px 16px 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
transition: box-shadow 0.2s;
margin-bottom: 0;
}
.friend-item:hover {
box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
.friend-item img {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #eee;
margin-bottom: 12px;
display: block;
}
.friend-item strong {
font-size: 1.08em;
color: #222;
margin-bottom: 6px;
text-align: center;
word-break: break-all;
}
.friend-item strong {
font-size: 1.08em;
color: #222;
margin-bottom: 6px;
text-align: center;
word-break: break-all;
display: block; /* 關鍵:讓 strong 占滿一行 */
width: 100%; /* 關鍵:寬度100% */
}
.friend-item strong a {
color: #222;
text-decoration: none;
transition: color 0.2s;
display: block; /* 關鍵:讓 a 也占滿一行 */
text-align: center; /* 關鍵:居中 */
width: 100%;
}
.friend-item div > div {
color: #888;
font-size: 1em;
margin-top: 2px;
text-align: center;
word-break: break-all;
}
/* 響應式:手機端優化 */
@media (max-width: 600px) {
.friend-links-row {
gap: 16px 0;
}
.friend-item {
width: 90vw;
max-width: 340px;
min-width: 0;
margin: 0 auto;
padding: 16px 6px 12px 6px;
}
.friend-item img {
width: 60px;
height: 60px;
}
}
代碼由 Cursor 生成,親測有效。如有問題歡迎在下面留言~