Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Floating modal window under a button

Tags:

css

I need show a notication modal window.. But since its a fluid layout the position changes on bigger screens. How can i position the modal window below the link like in image. I want it in the exact position. How do i go about doing it? enter image description here

like image 581
nickfrancis.me Avatar asked Mar 29 '26 22:03

nickfrancis.me


1 Answers

This should work as a base for you.

HTML

<div class="notificaton-bar">
    <div class="notice">Notification
        <div>
            Here is the applicable note.
        </div>    
    </div>
</div>

CSS

.notificaton-bar {
    background-color: #999999;
    padding: 0 10px;
}

.notice {
    position: relative;
    display: inline-block;
    background-color: inherit;
    font-size: 1.5em;
    min-width: 140px;
    padding: 10px 5px;
    text-align: center;
}

.notice div {
    display: none;
    width: 130px;
    padding: 10px;
    font-size: .75em;
    text-align: left;
    background-color: inherit;
    border-radius: 10px;
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -75px;
    margin-top: 10px;    
}

.notice div:before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 11px solid #999999;
    position: absolute;
    top: -10px;
    left: 50%;
    margin-left: -10px;
}

.notice:hover div {
    display: block;
}
like image 175
ScottS Avatar answered Apr 02 '26 02:04

ScottS