W3.CSS Mobile(移动)
创建一个基本的移动页面
CSS 的专业版非常适合移动应用程序。它很小,而且非常快。
实例
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3pro.css">
<body>
<!-- Content here -->
</body>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3pro.css">
<body>
<!-- Content here -->
</body>
尝试一下 »
添加内容
实例(使用经典的HTML元素)
<div class="w3-container"><h1>电影 2014</h1></div>
<div class="w3-cell-row"><div class="w3-cell"><img src="img_avatar.jpg"></div>
<div class="w3-cell w3-container"><h3>Frozen</h3>
<p>人们对动画的反应很荒谬.</p></div></div>
<div class="w3-container"><h3>页脚</h3></div>
<div class="w3-cell-row"><div class="w3-cell"><img src="img_avatar.jpg"></div>
<div class="w3-cell w3-container"><h3>Frozen</h3>
<p>人们对动画的反应很荒谬.</p></div></div>
<div class="w3-container"><h3>页脚</h3></div>
尝试一下 »
实例(使用语义HTML元素)
<header class="w3-container"><h1>页眉</h1></header>
<div class="w3-cell-row"><div class="w3-cell"><img src="img_avatar.jpg"></div>
<div class="w3-cell w3-container"><h3>Frozen</h3>
<p>人们对动画的反应很荒谬.</p></div></div>
<footer class="w3-container"><h3>页脚</h3></footer>
<div class="w3-cell-row"><div class="w3-cell"><img src="img_avatar.jpg"></div>
<div class="w3-cell w3-container"><h3>Frozen</h3>
<p>人们对动画的反应很荒谬.</p></div></div>
<footer class="w3-container"><h3>页脚</h3></footer>
尝试一下 »
添加颜色主题
实例
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-blue.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-red.css">
尝试一下 »
添加更多的风格
实例
<img class="w3-circle" src="img_avatar.jpg" alt="avatar">
<h3 class="w3-text-theme">Frozen</h3>
<h3 class="w3-text-theme">Frozen</h3>
尝试一下 »
添加侧边导航栏
实例
<nav class="w3-sidebar w3-bar-block w3-card" style="width:30%">
<div class="w3-red">
<a href="javascript:void(0)" onclick="closeSidebar()"
class="w3-button w3-display-topright w3-xlarge">X</a>
<div class="w3-padding-large w3-center">
<img class="w3-circle" src="img_avatar.jpg" alt="avatar">
</div>
</div>
<a class="w3-bar-item w3-button" href="#">主页</a>
<a class="w3-bar-item w3-button" href="#">朋友圈</a>
<a class="w3-bar-item w3-button" href="#">消息</a>
</nav>
<script>
function openSidebar() {
document.getElementById("mySidebar").style.display = "block";}
function closeSidebar() {
document.getElementById("mySidebar").style.display = "none";}</script>
<div class="w3-red">
<a href="javascript:void(0)" onclick="closeSidebar()"
class="w3-button w3-display-topright w3-xlarge">X</a>
<div class="w3-padding-large w3-center">
<img class="w3-circle" src="img_avatar.jpg" alt="avatar">
</div>
</div>
<a class="w3-bar-item w3-button" href="#">主页</a>
<a class="w3-bar-item w3-button" href="#">朋友圈</a>
<a class="w3-bar-item w3-button" href="#">消息</a>
</nav>
<script>
function openSidebar() {
document.getElementById("mySidebar").style.display = "block";}
function closeSidebar() {
document.getElementById("mySidebar").style.display = "none";}</script>
尝试一下 »
固定导航页眉和页脚