简体   繁体   中英

footer button in Android Browser

I am new to CSS and developing a simple template which will be showed inside an Android Browser. Basically my template only has two elements, an error message, and a button (should be placed at footer). I have read a few posts at stackoverflow. People suggest to use

position:fixed;
bottom: 0;

to place an element at footer. However, when I added this my button css, it seems my button was just placed right below the error message instead of at the footer. Anyone has any ideas why?

            .fulfill-application-button{
            display: inline-block;
            width: 100%;
            zoom: 1;
            margin: 0;
            text-align: center;
            cursor: pointer;
            border: 1px solid #bbb;
            overflow: visible;
            font: bold 25px arial, helvetica, sans-serif;
            text-decoration: none;
            white-space: nowrap;
            color: #555;
            background-color: #ddd;
            transition: background-color .2s ease-out;
            background-clip: padding-box;
            border-radius: 3px;
            box-shadow: 0 1px 0 rgba(0, 0, 0, .3),
                      0 2px 2px -1px rgba(0, 0, 0, .5),
                      0 1px 0 rgba(255, 255, 255, .3) inset;
            text-shadow: 0 1px 0 rgba(255,255,255, .9);
        }

        .fulfill-application-button:hover{
            background-color: #eee;
            color: #555;
        }

        .fulfill-application-button:active{
            background: #e9e9e9;
            position: relative;
            top: 1px;
            text-shadow: none;
            box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset;
        }

        .fulfill-application-button.color{
            color: #fff;
            text-shadow: 0 1px 0 rgba(0,0,0,.2);
        }

        .fulfill-application-button.ok{
            position: relative;
            bottom: 0;
            padding: 10px 90px;
            background-color: #c43c35;
            border-color: #c43c35;
        }

        .fulfill-application-button.ok:hover{
            background-color: #ee5f5b;
        }

        .fulfill-application-button.ok:active{
            background: #c43c35;
        }

        html,body
        {
            padding: 15px;
            height: 100%;
            background-color: black;
        }

        div.error-message{
            color: white;
            line-height: 120%;
            padding-top: 20%;
            font-size:30px;
        }
     </style>
<body>
       <div class ="error-message">
            ${error}
       </div>
       <button id="ok" type="button" class="color ok fulfill-application-button">
            OK
       </button>
</body>

Change position: relative; to position: fixed; from class .fulfill-application-button.ok

Code :

.fulfill-application-button.ok{
            position: fixed;
            bottom: 0;
            padding: 10px 90px;
            background-color: #c43c35;
            border-color: #c43c35;
        }

Note : You can give right and left for the same, if you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM