
Iconos con enlace en bootstrap con font awesome
Publicado por Laura (1 intervención) el 05/01/2022 06:36:56
Hola
Estoy usando bootstrap intentando colocar unos iconos con enlace, usando font awesome en el css pero cuando uso los atributos y seudoclases para seleccionar elementos particulares no me deja cambiar los iconos. Pues conserva el content: f35d que es el del enlace.
Primero genere el enlace en html y en css le di las propiedades de color y tamaño, anexe font awesome y añadi el content: "f/35d" pero cuando hago una seleccion más especifica como cambiar ese iconoc de enlace por el de facebook no me permite cambiar el icono.
Dejo como tengo el codigo en HTML y CSS que puedo hacer?
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="https://kit.fontawesome.com/02a32cf02b.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<header class="encabezado-sitio container">
<div class="row justify-content-md-between">
<div class="col-lg-4">
<a href="index.html">
<img src="img/logo.svg" class="img-fluid mx-auto d-block">
</a>
</div>
<div class="col-lg-4">
<nav class="sociales">
<ul>
<li> <a href="http://facebook.com">
<span class="sr-only"> Facebook
</span>
</a>
</li>
<li><a href="http://instagram.com">
<span class="sr-only"> Instagram
</span>
</a>
</li>
CSS
.sociales ul{
list-style: none;
margin: 0;
padding: 0;
}
.sociales ul li{
position: relative;
display: inline-block;
}
.sociales ul li a:before{
font-family:'Font Awesome 5 Free';
font-weight: 900;
display: inline-block;
vertical-align: top;
padding: 0.8rem;
content:"\f35d";
-webkit-font-smoothing: antialiased;
font-size: 2.5rem;
color: #5fcde9;
}
.sociales ul li a [href*="http//:facebook.com"]::before{
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f007";
}
.sociales ul li a [href*="http//:instagram.com"]::before{
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f007";
}
Estoy usando bootstrap intentando colocar unos iconos con enlace, usando font awesome en el css pero cuando uso los atributos y seudoclases para seleccionar elementos particulares no me deja cambiar los iconos. Pues conserva el content: f35d que es el del enlace.
Primero genere el enlace en html y en css le di las propiedades de color y tamaño, anexe font awesome y añadi el content: "f/35d" pero cuando hago una seleccion más especifica como cambiar ese iconoc de enlace por el de facebook no me permite cambiar el icono.
Dejo como tengo el codigo en HTML y CSS que puedo hacer?
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="https://kit.fontawesome.com/02a32cf02b.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<header class="encabezado-sitio container">
<div class="row justify-content-md-between">
<div class="col-lg-4">
<a href="index.html">
<img src="img/logo.svg" class="img-fluid mx-auto d-block">
</a>
</div>
<div class="col-lg-4">
<nav class="sociales">
<ul>
<li> <a href="http://facebook.com">
<span class="sr-only"> Facebook
</span>
</a>
</li>
<li><a href="http://instagram.com">
<span class="sr-only"> Instagram
</span>
</a>
</li>
CSS
.sociales ul{
list-style: none;
margin: 0;
padding: 0;
}
.sociales ul li{
position: relative;
display: inline-block;
}
.sociales ul li a:before{
font-family:'Font Awesome 5 Free';
font-weight: 900;
display: inline-block;
vertical-align: top;
padding: 0.8rem;
content:"\f35d";
-webkit-font-smoothing: antialiased;
font-size: 2.5rem;
color: #5fcde9;
}
.sociales ul li a [href*="http//:facebook.com"]::before{
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f007";
}
.sociales ul li a [href*="http//:instagram.com"]::before{
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f007";
}
Valora esta pregunta


0