/ / Bootstrap Modal Image Background - css, twitter-bootstrap, modalne okno dialogowe, bootstrap-modal

Bootstrap Modal Image Background - css, twitter-bootstrap, modalne okno dialogowe, bootstrap-modal

Po prostu chcę zapytać, czy możliwe jest posiadanieobraz tła w moim modalu? Próbowałem już szukać, ale widzę tylko związane z nim rzeczy na modalu, które odnoszą się do samej strony. Czego chcę, to moje pole modalne, aby mieć na nim tło graficzne lub zmienić kolor? Dzięki. Nie jestem tak dobry w CSS. Dzięki.

Odpowiedzi:

4 dla odpowiedzi № 1

Zakładając, że chcesz mieć obraz w ciele modalnym, możesz go użyć

.modal-body {
background-image: url(path/to/image);
}

Lub jeśli chcesz go za swoim modalem, możesz go użyć

.modal-backdrop {
background-image: url(path/to/image);
}

0 dla odpowiedzi nr 2

Tak, po prostu użyj background-image: url(path/to/your/image);

$("#myModal").modal() 
.modal-body {
background-image: url("http://myfunnymemes.com/wp-content/uploads/2015/04/Doge-Meme-Lion-In-All-Its-Majestic-Glory.jpg");
background-repeat: no-repeat;
background-size: cover;
height: 400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
test
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>


0 dla odpowiedzi № 3

Zakładam, że używasz bootstrap od

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/js/bootstrap.min.js"></script>

Będziesz musiał edytować swój

<div class="modal-content">
...
</div>

do:

<div class="modal-content modal-popout-bg">

css:

.modal .modal-popout-bg {
background: url("http://somepic.com/somepic.jpg");
}