我有一個模式設置,使用Bootstrap,它工作得很好。模態顯示一些文字和圖像。當我將鼠標懸停在模式元素上時,出現了一個很好的藍色突出顯示,我想保留該突出顯示。問題是,當我關閉模式窗口時,藍色突出顯示位於button
上,我想擺脫這種情況。模態焦點高亮顯示在關閉模態窗口後仍保留在元素上
我覺得這個CSS ...
.modal-open .modal,
.btn:focus{
outline: none !important;
}
...將消除亮點,但我還是用藍色突出離開後我關閉模式。以下是該模式的代碼...
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"><img src='http://lorempixel.com/g/400/200'></button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Some Title</h4>
</div>
<div class="modal-body">
<p>Some text about something, Some text about something, Some text about something.</p>
<a href='http://codepen.io'><img src='http://lorempixel.com/g/400/200'></a>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
在此先感謝您的任何幫助。
我認爲你正在尋找的僞類':active'而不是':focus' – reinder
這是我第一次嘗試,仍有突出顯示... –