javascript - Add a close icon in a panel -
i want add close icon on right of title of panel. cannot put inside panel:
<!doctype html> <html> <head> <script src="https://code.jquery.com/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <title>js bin</title> <style> .panel { background: #ffffff; padding: 7px 10px; } .x_title { border-bottom:2px solid #e6e9ed; margin-bottom:10px; padding:1px 5px 6px; font-size:16px; } .x_title .actions { position: absolute; right: 0; top: 0; line-height: 3 } .x_title .list-inline { margin-left: -13px; padding-left: -5px; } .x_content { margin-top:5px; padding:0 5px 6px; } </style> </head> <body> <div class="panel"> <div class="x_title"> panel <div class="actions list-inline"> <a href="#" onclick="$('.panel').hide(); $('#br').hide();">×</a> </div> </div> <div class="x_content"> content </div> </div> </body> </html>
could me amend this?
additionally, don't know if best way add close icon. bootstrap has modal
, seems modal used pop-up window rather panel inside page. 1 know conventional way add close icon (and collapse icon) bootstrap , jquery?
an element position: absolute;
position relative page unless parent has position: relative;
.
what need change .x_title
, so:
.x_title { border-bottom:2px solid #e6e9ed; margin-bottom:10px; padding:1px 5px 6px; font-size:16px; position: relative; }
by giving position: relative;
, right: 0;
on actions
div refers right edge of x_title
, rather right edge of page.
Comments
Post a Comment