我正在尝试使用物化卡及其旁边的单独按钮来显示模式视图。一切似乎都工作正常,但是当我单击模式时,模式内容不会显示在CSS的规定值中,例如模式视图的高度以及激活模式视图时相关的变暗背景阴影(在页面上停住一半)。当我禁用<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
时,它可以工作,但是然后实现内容失败。有没有一种方法可以使所有内容都可以实现Materialise内容以及模态视图高度和变暗的背景阴影?
HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<span style="display:flex; justify-content:flex-end; width:100%; padding:0;">
<button id="myBtn">Open Modal</button>
</span>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<form id="msform">
<fieldset>
<h2 class="fs-title">Create Discount</h2>
<h3 class="fs-subtitle">Step 1</h3>
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
</form>
</div>
</div>
CSS:
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 1000%; /* Full height */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
/* background-color: #fefefe; */
background: linear-gradient(-45deg, #89f7fe 0%, #66a6ff 60%, #23A6D5, #23D5AB);
margin:auto;
padding: 20px;
border: 1px solid #888;
width: 500px;
height: 500px
}
答案 0 :(得分:0)
我能够弄清楚-我只需要在.modal中将高度设置为“最大高度”即可;身高只是个问题,但是在导入<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">