Make floating DIV appear over all element (page content) using CSS

RichardSa
 
on Jul 08, 2021 02:13 AM
Sample_161940.zip
826 Views

I created a call now button which a user can click and it will redirect to call.

But the issue I am having is that the div which the phone icon and "Call us Now" label appears behind another div tag "row".

How can I make the div tag which contains the phone icon to position itself on top every content of the page?

https://i.imgur.com/sWUMt3W.jpg

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jul 08, 2021 02:45 AM

Hi RichardSa,

Set the z-index.

Refer below code.

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!-- Required meta tags -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
    <link href='https://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' />
    <title>Home - SuperLife</title>
    <style type="text/css">
        .wrapper {
            font-family: Nunito;
            background-repeat: no-repeat;
            height: 100%;
            background-position: center;
            background-size: cover;
            overflow: hidden;
            position: relative;
        }

        .navbar-nav {
            margin-left: auto;
        }

        .navbar {
            background-color: #0a6879;
        }

        .nav-link {
            color: #fff;
        }

        .navbar-brand {
            color: #fff;
        }

        #Calls {
            display: block;
            width: auto;
            position: absolute;
            padding: 2px 15px;
            font-size: 15px;
            word-break: keep-all;
            position: fixed;
            top: 60%;
            right: 0px;
            color: #fff;
            z-index: 100;
        }

        #img2 {
            width: 100%;
            height: 40%;
            position: relative;
        }

        #imgone {
            width: 100%;
            height: auto;
            position: relative;
        }

        #btnsrch {
            border-radius: 18px;
            background-color: #086887;
            font-weight: 700;
            width: auto;
            margin: 3px;
        }

        #TextBoxsearch {
            border-radius: 18px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="wrapper">
            <nav class="navbar navbar-expand-lg fixed">
                <a class="navbar-brand" href="#" style="font-weight:800;font-size:18pt;">Music Shop</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation" style="border-color: #fff; border-width: 1px; background-color: transparent;color: #fff;">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNav">
                    <ul class="navbar-nav">
                        <li class="nav-item active">
                            <a class="nav-link active" href="Index.aspx">Home <span class="sr-only">(current)</span></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="biz.aspx">Gallery</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Contact Us</a>
                        </li>
                    </ul>
                    <div class="form-inline">
                        <asp:TextBox ID="TextBoxsearch" runat="server" CssClass="form-control" Font-Size="11pt" placeholder="Type your Search Here" />
                        <asp:Button ID="btnsrch" runat="server" class="btn btn-success" Text="Search" />
                    </div>
                </div>
            </nav>
            <div class="call-icon" id="Calls">
                <span>
                    <label style="color: #050505; font-weight: 600; font-family: Nunito; border: 1px solid; background-color:#FEFCFF; border-color: rgba(100, 126, 133, 0.20); border-radius: 8px;">Call us Now</label>
                    <img alt="" src="Image/homeimg/pone.png" height="65" style="cursor: pointer;background-color: #0b77ae; border-radius:50%;" />
                </span>
            </div>
            <div style="text-align: center; font-family:Tahoma; font-weight:900;">
                <h1>Heading</h1>
            </div>
            <div style="background-color: #c1d8e9; width: 90%; margin: auto; padding: 10px;">
                <br />
                <div class="row" style=" position: relative;">
                    <div class="col-sm-6" style="text-align: center;">
                        <label style="font-weight: 700; font-size: 15pt;">Jazz For the Matured Mind</label>
                        <img id="imgone" alt="STC-3" src="Image/2020-02-09 20.56.12.png" />
                        <p style="font-weight: 500; font-style: italic;">
                            It's our privilege to have you all in this Noble group.
                            I strongly believe that every one of us have dreams and aspirations in life but we all need a
                            Vehicle to take us to where we are going.
                        </p>
                        <p style="font-weight: 500; font-style: italic;">
                            It's our privilege to have you all in this Noble group.
                            I strongly believe that every one of us have dreams and aspirations in life but we all need a
                            Vehicle to take us to where we are going.
                        </p><hr />
                    </div>
                    <div class="col-sm-6" style="text-align: center;">
                        <label style="font-weight: 700; font-size: 16pt;">Imaginations - Thoughts for Growth</label>
                        <img id="img2" alt="SNC" src="Image/FB_IMG_1581590409726.jpg" />
                        <p style="font-weight: 500; font-style: italic;">
                            It's our privilege to have you all in this Noble group.
                            I strongly believe that every one of us have dreams and aspirations in life but we all need a
                            Vehicle to take us to where we are going.
                        </p>
                        <p style="font-weight: 500; font-style: italic;">
                            It's our privilege to have you all in this Noble group.
                            I strongly believe that every one of us have dreams and aspirations in life but we all need a
                            Vehicle to take us to where we are going.
                        </p><hr />
                    </div>
                </div>
                <br />
            </div>
        </div>
    </form>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
</body>
</html>