表单、内联框架以及CSS基础
16lz
2022-04-28
1. 表单、内联框架以及CSS基础
登录表单
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录表单</title>
</head>
<body>
<div>
<form action="check.php" method="post">
<label for="username">用户名:</label>
<input type="text " name="username" id="username" value="" autofocus placeholder="不能超过六位" required />
</div>
<div>
<label for="pwd">密码: </label>
<input type="password" name="pwd" id="pwd" value="" required placeholder="字母+数字">
</div>
<div>
<label for="myemail">邮箱: </label>
<input type="email" name="email" id="myemail" value="" required placeholder="@qq.com">
</div>
<div>
<label for="male">性别: </label>
<input type="radio" id="male" name="sex" checked><label for="male">男</label>
<input type="radio" id="female" name="sex" ><label for="female">女</label>
</div>
<div>
<label for="">兴趣: </label>
<input type="checkbox" name="aihao[]" id="game" checked> <label for="game">王者</label>
<input type="checkbox" name="aihao[]" id="php"> <label for="php">php</label>
<input type="checkbox" name="aihao[]" id="youyon"checked> <label for="youyon">游泳</label>
</div>
<div>
<label for="city">城市: </label>
<select name="city" id="city">
<option value="1" selected >广东</option>
<option value="2" >上海</option>
<option value="3">北京</option>
</select>
</div>
<!-- 多行文本框 -->
<textarea name="" id="" cols="30" rows="10" placeholder="请输入内容"></textarea>
<div><button>提交登录</button></div>
</form>
</body>
</html>
效果图
2. 简单的后台架构实现
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>简单后台架构</title>
<style>
body {
height: 100vh;
width: 100vw;
display: grid;
grid-template-columns: 10em 1fr;
grid-template-rows: 6em 1fr;
margin: 0;
}
body .header {
grid-column-end: span 2;
border-bottom: 1px solid currentColor;
background-color: #efe;
padding: 2em;
display: flex;
align-items: center;
}
body .header div {
margin-left: auto;
}
body .nav {
background-color: #efc;
margin: 0;
padding-top: 1em;
list-style: none;
}
body iframe {
width: calc(100vw - 10em);
height: calc(100vh - 6em);
border-left: 1px solid currentColor;
}
</style>
</head>
<body>
<!-- 头部 -->
<div class="header">
<h1>后台管理</h1>
<div>
<span>admin</span>
<a href="">退出</a>
</div>
</div>
<!-- 左侧导航 -->
<ur class="nav">
<li><a href="1.html" target="content">菜单项1</a></li>
<li><a href="2.html" target="content">菜单项2</a></li>
<li><a href="3.html" target="content">菜单项3</a></li>
<li><a href="4.html" target="content">菜单项4</a></li>
</ur>
<!-- 右侧内容 -->
<iframe src="" frameborder="0" name="content"></iframe>
</body>
</html>
效果图
3. 元素样式来源与优先级
来源1,浏览器默认样式/代理默认样式
代码:<h1>hello word</h1>
效果图
来源2,自定义样式 会覆盖默认样式
第一种 style属性
代码:<h1 style="color: red;">hello</h1>
效果图
第二种 style 标签
代码:
<h1>111</h1>
<h1>222</h1>
<style>
h1{color: blue;}
</style>
效果图
第三种外部引用css
代码:
<link rel="stylesheet" href="style.css">
<h1>555</h1>
效果图
或者
<style>
@import url(style.css);
</style>
<h1>1111</h1>
效果图
来源3: 书写顺序,写在后面的同名属性会覆盖前面的(优先级相同的情况下) 某些属性具有继承特征,例如颜色,字号,字体,子元素会继承父元素的同名属性
代码:
<style>
div{color: red;}
</style>
<div>
<h1>66666</h1>
</div>
效果图
更多相关文章
- Android(安卓)中使用代码动态网格布局
- Android(安卓)实现语音识别的完整代码
- Android(安卓)Material Design之在RecyclerView中嵌套CardView实
- Android(安卓)实现文件上传功能(upload)
- Android(安卓)Studio 添加 C、C++ 代码
- Android(安卓)根据城市获取经纬度 适配Android(安卓)7.0 、Andro
- Android(安卓)轻松实现语音识别的完整代码[转]
- Android(安卓)Studio下jni应用
- android user版本进行编译出现proguard错误混淆