在我成功将 font Awesome 链接链接到我的 html 后,我发现很难给 font Awesome 图标边框半径
我尝试对图标进行分类并将其边框半径设置为 50%,但没有成功。如果我的问题能得到解决,我会很高兴。
将
overflow: hidden
添加到 .rounded-icon
类以隐藏任何超出其边界的内容。
i {
font-size: 30px;
}
.rounded-icon {
border-radius: 100%;
overflow: hidden;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Font Awesome Border Radius</title>
<!-- Link to Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>
<body>
<!-- Example usage of Font Awesome icon with border radius -->
<i class="fas fa-user rounded-icon"></i>
<i class="fas fa-user"></i>
<i class="fas fa-share-alt-square rounded-icon"></i>
<i class="fas fa-share-alt-square"></i>
<i class="fas fa-phone-square rounded-icon"></i>
<i class="fas fa-phone-square"></i>
<i class="fas fa-shapes rounded-icon"></i>
<i class="fas fa-shapes"></i>
<i class="fas fa-th-large rounded-icon"></i>
<i class="fas fa-th-large"></i>
</body>
</html>