我听说最好将 CSS 保存在另一张纸中,我就是这样做的。我不知道如何使这部分在 CSS 样式表中工作
<div style=max-width:90%>
现在我就这样写并且它可以工作,只是想知道是否还有其他更好的方法来做到这一点。现场预览
<!--home page-->
<section class="home container-fluid">
<div class="row">
<div class="col-lg-6 mt-5 py-5 pl-5">
<div style=max-width:90%>
<img class="img-fluid" alt=" " src="img/app_screens_01.png">
</div>
</div>
<div class="col-lg-6 my-auto px-5">
<h1 class="home-content-heading">This is just the beginning</h1>
</div>
始终建议将所有样式保留在 css 文件中。您可以将 class/id 分配给 div 并在 css 文件中添加样式。
<div class='some_class'>
在css文件中(当然你必须在html中调用这个css)
.some_class
max-width:90%
注意:- 你的类名或 id 名称应该是唯一且有意义的,以便更好地理解,而不是像我仅作为示例使用的
some_class
。