Search code examples
htmlcssbootstrap-4mousehover

Making a row to have hover effect in Bootstrap 4 without using a table


I was wondering if there was a way to make a row here hover? I want to point out I am not using a table to create this, but using the grid system in Bootstrap 4. Is it even possible? Everything I have researched points to that you need to create a table in order for this to happen.

 <div class="row">
        <div class="report-card-i report-card-i-height">
            <h3 class="m-l-35 p-t-25 p-b-10">Compliance</h3>
            <div class="fa-orange m-t-10 m-b-15 m-l-80">
                <div class="row">
                    <div class="col-sm-1 col-xs-1 text-center">
                        <i class="fa fa-star m-r-15 text-center" style="font-weight: bold">Adjustment</i>
                    </div>
                    <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                        <p>21,922</p>
                    </div>
                    <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                        <p>$0.00</p>
                    </div>
                    <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                        <p>$304,012.23</p>
                    </div>
                    <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                        <p>$0.00</p>
                    </div>
                    <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                        <p>$0.00</p>
                    </div>
                    <div class="col-sm-1 col-xs-1 text-center">
                        <i class="fa fa-angle-right text-center" style="font-weight: bold"></i>
                    </div>
                </div>
        </div>
    </div>


Solution

  • .mydiv div:hover{background-color:gray;}
    <div class="row">
            <div class="report-card-i report-card-i-height">
                <h3 class="m-l-35 p-t-25 p-b-10">Compliance</h3>
                <div class="fa-orange m-t-10 m-b-15 m-l-80">
                    <div class="row mydiv">
                        <div class="col-sm-1 col-xs-1 text-center">
                            <i class="fa fa-star m-r-15 text-center" style="font-weight: bold">Adjustment</i>
                        </div>
                        <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                            <p>21,922</p>
                        </div>
                        <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                            <p>$0.00</p>
                        </div>
                        <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                            <p>$304,012.23</p>
                        </div>
                        <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                            <p>$0.00</p>
                        </div>
                        <div class="col-sm-1 col-xs-2 col-lg-offset-1 text-center">
                            <p>$0.00</p>
                        </div>
                        <div class="col-sm-1 col-xs-1 text-center">
                            <i class="fa fa-angle-right text-center" style="font-weight: bold"></i>
                        </div>
                    </div>
            </div>
        </div>