Icone bootstrap 4.0

Asked

Viewed 197 times

1

I tried to change only the icone classes and it didn’t work out, what am I doing wrong? And how to change the color when I opened the card

Previous question I opened icone no accordion bootstrap 4.0

Thank you.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen"
        href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" media="screen"
        href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
    <style>

.card-header {
    cursor: pointer;
}

.card-header .fa-fa-plus{
    display: none;
}
.card-header.collapsed .fa-fa-plus{
    display: inline-block;
}
.card-header.collapsed .fa-fa-minus{
    display: none;
}
    </style>
</head>

<body>

    <!------ Include the above in your HEAD tag ---------->
    <div class="container">
        <div class="row my-3">
            <div class="col-sm-12">
                Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf
                moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
                Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda
                shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea
                proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim
                aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
            </div>
        </div>
    </div>

    <div class="container ">
        <div class="row my-4">
            <div class="col-sm-12">
                <div id="accordion">
                    <div class="card mb-3">
                        <div class="card-header p-0 collapsed d-flex align-items-center" id="headingOne" data-toggle="collapse" data-target="#collapseOne"
                        aria-expanded="true" aria-controls="collapseOne">
                            <h5 class="mb-0">
                                <button class="btn btn-link " >
                                    Collapsible Group Item #1
                                </button>
                            </h5>
                           <i class="fa fa-minus ml-auto mr-3" aria-hidden="true"></i>
<i class="fa fa-plus ml-auto mr-3" aria-hidden="true"></i>
                        </div>

                        <div id="collapseOne" class="collapse" aria-labelledby="headingOne"
                            data-parent="#accordion">
                            <div class="card-body">
                                Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad
                                squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck
                                quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it
                                squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
                                craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur
                                butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth
                                nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
                            </div>
                        </div>
                    </div>
                    <div class="card mb-3">
                        <div class="card-header p-0 collapsed d-flex align-items-center" id="headingTwo"  data-toggle="collapse" data-target="#collapseTwo"
                        aria-expanded="false" aria-controls="collapseTwo">
                            <h5 class="mb-0">
                                <button class="btn btn-link collapsed">
                                    Collapsible Group Item #2
                                </button>
                            </h5>
                            <i class="fa fa-minus ml-auto mr-3" aria-hidden="true"></i>
<i class="fa fa-plus ml-auto mr-3" aria-hidden="true"></i>
                        </div>
                        <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
                            <div class="card-body">
                                Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad
                                squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck
                                quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it
                                squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
                                craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur
                                butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth
                                nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
                            </div>
                        </div>

                </div>
            </div>
        </div>
    </div>
    </div>
    <div class="container">
        <div class="row my-3">
            <div class="col-sm-6">
            <img src="https://ap.imagensbrasil.org/images/2019/05/03/MARKETING.png"
                    alt="Deiliberações do ceca"
                    class="img-fluid rounded" alt="Responsive image">
            </div>
            <div class="col-sm-6">
            <img src="https://ap.imagensbrasil.org/images/2019/05/03/MARKETING.png"
                    alt="Noticias do ceca"
                    class="img-fluid rounded" alt="Responsive image">
            </div>
        </div>
    </div>



    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>

</html>

Execute Return to post

1 answer

0


This is the list of classes for you to use in Fontawesome, for starters you wrote the wrong class .fa-fa-plus should if .fa.fa-plus or just .fa-plus https://fontawesome.com/v4.7.0/cheatsheet/

inserir a descrição da imagem aqui

About changing the color you can use your own .collapsed plus the .fa that precedes all icons to change the color (since Fontawesome is a fonte normal as Arial) when open or closed, even so you changing fa fa-chevron-up for fa fa-plus the color exchange keeps happening .card-header.collapsed .fa { color:red; }

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen"
        href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" media="screen"
        href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
    <style>

.card-header {
    cursor: pointer;
}

.card-header .fa-plus{
    display: none;
}
.card-header.collapsed .fa-plus{
    display: inline-block;
}
.card-header.collapsed .fa-minus{
    display: none;
}
.card-header.collapsed .fa{
    color:red;
}
.card-header .fa{
    color: blue;
}

    </style>
</head>

<body>

    <!------ Include the above in your HEAD tag ---------->
    <div class="container">
        <div class="row my-3">
            <div class="col-sm-12">
                Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf
                moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
                Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda
                shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea
                proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim
                aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
            </div>
        </div>
    </div>
  
    <div class="container ">
        <div class="row my-4">
            <div class="col-sm-12">
                <div id="accordion">
                    <div class="card mb-3">
                        <div class="card-header p-0 collapsed d-flex align-items-center" id="headingOne" data-toggle="collapse" data-target="#collapseOne"
                        aria-expanded="true" aria-controls="collapseOne">
                            <h5 class="mb-0">
                                <button class="btn btn-link " >
                                    Collapsible Group Item #1
                                </button>
                            </h5>
                           <i class="fa fa-minus ml-auto mr-3" aria-hidden="true"></i>
<i class="fa fa-plus ml-auto mr-3" aria-hidden="true"></i>
                        </div>

                        <div id="collapseOne" class="collapse" aria-labelledby="headingOne"
                            data-parent="#accordion">
                            <div class="card-body">
                                Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad
                                squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck
                                quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it
                                squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
                                craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur
                                butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth
                                nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
                            </div>
                        </div>
                    </div>
                    <div class="card mb-3">
                        <div class="card-header p-0 collapsed d-flex align-items-center" id="headingTwo"  data-toggle="collapse" data-target="#collapseTwo"
                        aria-expanded="false" aria-controls="collapseTwo">
                            <h5 class="mb-0">
                                <button class="btn btn-link collapsed">
                                    Collapsible Group Item #2
                                </button>
                            </h5>
                            <i class="fa fa-minus ml-auto mr-3" aria-hidden="true"></i>
<i class="fa fa-plus ml-auto mr-3" aria-hidden="true"></i>
                        </div>
                        <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
                            <div class="card-body">
                                Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad
                                squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck
                                quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it
                                squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
                                craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur
                                butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth
                                nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
                            </div>
                        </div>
                    
                </div>
            </div>
        </div>
    </div>
    </div>
    <div class="container">
        <div class="row my-3">
            <div class="col-sm-6">
            <img src="https://ap.imagensbrasil.org/images/2019/05/03/MARKETING.png"
                    alt="Deiliberações do ceca"
                    class="img-fluid rounded" alt="Responsive image">
            </div>
            <div class="col-sm-6">
            <img src="https://ap.imagensbrasil.org/images/2019/05/03/MARKETING.png"
                    alt="Noticias do ceca"
                    class="img-fluid rounded" alt="Responsive image">
            </div>
        </div>
    </div>
    


    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>

</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.