学习HTML

常用标签.html

<body>
	<p>这是一个段落。</p><br>
	<strong>这个文本是加粗的</strong><br>
	<b>加粗文本</b><br>
	<em>这个文本是斜体的</em><br>
	<i>斜体文本</i><br>
	<code>电脑自动输出</code><br>
	<sub>下标</sub><br>
	<sup>上标</sup><br>

	<big>这个文本字体放大</big><br>
	<small>这个文本是缩小的</small><br>
	<pre>
湖南文理学院,
燕山大学,
北京航空航空大学,
北京大学
</pre>


	<code>计算机输出</code>
	<br />
	<kbd>键盘输入</kbd>
	<br />
	<tt>打字机文本</tt>
	<br />
	<samp>计算机代码样本</samp>
	<br />
	<var>计算机变量</var>
	<br />

	<p>
		<b>注释:</b>这些标签常用于显示计算机/编程代码。
	</p>

	<address>
		Written by <a href="mailto:webmaster@example.com">Jon Doe</a>.<br>
		Visit us at:<br>
		Example.com<br>
		Box 564, Disneyland<br>
		USA
	</address>

	<abbr title="etcetera">etc.</abbr>
	<br />
	<acronym title="World Wide Web">WWW</acronym>
	<p>在某些浏览器中,当您把鼠标移至缩略词语上时,title 可用于展示表达的完整版本。</p>
	<p>仅对于 IE 5 中的 acronym 元素有效。</p>
	<p>对于 Netscape 6.2 中的 abbr 和 acronym 元素都有效。</p>
	<p>My favorite color is <del>blue</del> <ins>red</ins>!</p>



	<h1 style="text-align: center;">居中对齐标题</h1><br>
	<span style="font-size: 20px;">一个标题</span>
	<br />

	<a href="http://www.zysheep.cn" style="text-decoration: none;" target="_blank">zysheep</a>

	<table border="1px" cellpadding="10" cellspacing="10">
		<caption>学生信息表</caption>
		<tr>
			<th>姓名</th>
			<th>学号</th>
		</tr>
		<tr>
			<td>zysheep</td>
			<td>Z202014060523</td>
		</tr>
	</table>


	<h4>无序列表:</h4>
	<ul>
		<li>Coffee</li>
		<li>Tea</li>
		<li>Milk</li>
	</ul>

	<ol>
		<li>Coffee</li>
		<li>Tea</li>
		<li>Milk</li>
	</ol>
</body>

在这里插入图片描述

区块与布局

<body>

<h1>div布局</h1>
<div id="container" style="width: 500px">
	<div id="header" style="background-color: #FFA500;text-align: center;cursor: pointer;">
		<h1 style="margin-bottom: 0;">主要的网页标题</h1>
	</div>
	<div id="menu" style="background-color: #FFD700;height: 200px;width: 150px;float: left;">
		<ul>
			<li>菜单</li>
			<li>HTML</li>
			<li>CSS</li>
			<li>JavaScript</li>
		</ul>
	</div>
	<div id="content" style="background-color: #EEEEEE;height: 200px;width: 350px;float: left;">
		<h3>内容在这里</h3>
	</div>
    <div id="footer" style="background-color: #FFA500;text-align: center;"> 
    	版权 ©zysheep.com
    </div>
</div>


<h1>table布局</h1>
<table width="500" border="0">
	<tr>
		<td style="background-color:#FFA500;text-align: center;" colspan="2"> 
			<h1>主要的网页标题</h1>	
		</td>
	</tr>

	<tr >
		<td style="background-color:#FFD700;width:150px;height: 100px;vertical-align: top;">
			<ul>
				<li>菜单</li>
				<li>HTML</li>
				<li>CSS</li>
				<li>JavaScript</li>
			</ul>
		</td>
		<td style="background-color:#eeeeee;height:200px;width:350px;">内容在这里</td>
	</tr>

	<tr>
		<td style="background-color: #FFA500;text-align: center;" colspan="2">
			版权 ©zysheep.com
		</td>
	</tr>
</table>
</body>

在这里插入图片描述

iframe框架

<body>
	<div>
		<iframe src="day01.html" width="500" height="500" frameborder="0" name="iframe_1"></iframe>
		<a href="http://www.zysheep.cn" target="iframe_1" style="text-decoration: none;">zysheep.cn</a>
	</div>

	<div>
		<iframe src="day02.html" width="500" height="500"></iframe>
	</div>
</body>

在这里插入图片描述

H5新标签

<head>
	<title>H5新标签</title>
	<style type="text/css">
		header,
		section,
		footer,
		aside,
		nav,
		article,
		figure {
			display: block;
			margin: auto;
		}
	</style>
</head>

<body>
	<!--
HTML5中新的语义元素
<header>
<nav>
<section>
<article>
<aside>
<figcaption>
<figure>
<footer>
-->

	<!--<section> 标签定义文档中的节(section、区段)。比如章节、页眉、页脚或文档中的其他部分。 -->
	<section>
		<h1>WWF</h1>
		<p>The World Wide Fund for Nature (WWF) is an international organization working on issues regarding the cons
		</p>
	</section>

	<section>
		<h1>WWF's Panda symbol</h1>
		<p>The Panda has become the symbol of WWF. The well-known panda logo of WWF originated from a panda named Chi
			Chi that was transferred fro</p>
	</section>

	<!-- <article> 标签定义独立的内容。.-->
	<article>
		<h1>Internet Explorer 9</h1>
		<p>Windows Internet Explorer 9(缩写为 IE9 )在2011年3月14日21:00 发布。</p>
	</article>

	<!--<nav> 标签定义导航链接的部分。-->
	<nav>
		<a href="/html/">HTML</a> |
		<a href="/css/">CSS</a> |
		<a href="/js/">JavaScript</a> |
		<a href="/jquery/">jQuery</a>
	</nav>

	<!--<aside> 标签定义页面主区域内容之外的内容(比如侧边栏)。-->

	<p>My family and I visited The Epcot center this summer.</p>

	<aside>
		<h4>Epcot Center</h4>
		<p>The Epcot Center is a theme park in Disney World, Florida.</p>
	</aside>

	<!--<header>元素描述了文档的头部区域-->

	<article>
		<header>
			<h1>Internet Explorer 9</h1>
			<p><time pubdate datetime="2011-03-15"></time></p>
		</header>
		<p>Windows Internet Explorer 9(缩写为 IE9 )是在2011年3月14日21:00发布的</p>
	</article>

	<!--<footer> 元素描述了文档的底部区域.-->

	<footer>
		<p>Posted by: Hege Refsnes</p>
		<p><time pubdate datetime="2012-03-01">1</time></p>
	</footer>
</body>

在这里插入图片描述

CSS盒子模型

<head>
    <title>CSS盒子模型</title>
    <style type="text/css">
        #box1 {
            margin: auto;
            width: 150px;
            height: 150px;
            border: 5px solid blue;
            /*	margin-left: 10px;
			margin-top: 20px;*/
        }

        #box2 {

            background-color: blue;
            margin-left: 40px;
            margin-top: 20px;
            width: 50px;
            height: 50px;
            border: 5px solid red;
            text-align: center;
            padding: 5px;
            outline: green dotted thick;
        }
    </style>
</head>

<body>
    <div id="box1">
        <div id="box2">
            A
        </div>
    </div>

</body>

在这里插入图片描述

position定位

<head>
	<title>position定位</title>
	<style type="text/css">
		img.img1 {
			top: 0px;
			/*sticky 定位 基于用户的滚动位置来定位。*/
			position: sticky;
			width: 500px;
			height: 300px;
			margin-left: 30px;
			border: 2px solid #4CAF50;
		}

		/*
1. fixed 定位
 - 元素的位置相对于浏览器窗口是固定位置
2. relative 定位 
 - 相对定位元素的定位是相对其正常位置。
 - 移动相对定位元素,但它原本所占的空间不会改变。
 - 相对定位元素经常被用来作为绝对定位元素的容器块。
3. absolute 定位
 - 绝对定位的元素的位置相对于最近的已定位父元素,如果元素没有已定位的父元素,那么它的位置相对于<html>:
 - absolute 定位使元素的位置与文档流无关,因此不占据空间。
 - absolute 定位的元素和其他元素重叠。
4. sticky 定位
 - 基于用户的滚动位置来定位。
 - 粘性定位的元素是依赖于用户的滚动,在 position:relative 与 position:fixed 定位之间切换。
*/

		img.img2 {
			/*元素的位置相对于浏览器窗口是固定位置。即使窗口是滚动的它也不会移动:*/
			position: fixed;
			width: 200px;
			height: 100px;
			top: 30px;
			right: 5px;
		}

		img {
			display: block;
			margin-top: 10px;
		}
	</style>
</head>

<body>


	<img class="img1" src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
	<img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
	<img class="img2" src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
	<img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
	<img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
	<img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">

</body>

在这里插入图片描述

overflow属性

<head>
	<!-- 设置当元素的内容溢出其区域时发生的事情。 -->
	<title>overflow属性</title>
	<style type="text/css">
		div{
			border: 2px solid blue;
			background-color:#00FFFF;
			width: 150px;
			height: 100px;
			overflow: auto;
		}

	</style>
</head>
<body>
<div>
当你想更好的控制布局时你可以使用 overflow 属性。尝试修改 overflow 属性为: visible, hidden, scroll, 或 inherit 并查看效果。 默认值为 visible。
</div>
</body>

在这里插入图片描述

Float浮动

<head>
    <title>Float浮动</title>
    <style type="text/css">
        img {
            float: left;
            width: 110px;
            height: 90px;
            margin: 10px;
        }

        h2 {
            /*clear 属性指定元素两侧不能出现浮动元素。*/
            clear: both;
            margin-left: 10px;
        }
    </style>
</head>

<body>
    <img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
    <img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
    <h2>高清美女图片</h2>
    <img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
    <img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
    <img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
</body>

在这里插入图片描述

CSS 布局-水平&垂直对齐

<head>
	<title>CSS 布局-水平&垂直对齐</title>
	<style type="text/css">
		.center{
			/*1. 水平居中块级元素 (如 div), 可以使用 margin: auto;*/
			margin:auto;
			border: 2px solid #73AD21;
			width: 50%;
			padding: 10px;
			/*2. 文本居中对齐*/
			text-align: center;
		}	
		img{
			display: block;
			margin:auto;
		}

	</style>
</head>
<body>
<!--2. 元素居中对齐 块级元素-->

<div class="center">
div元素是居中的
</div>
<!--3. 要让图片居中对齐, 可以使用 margin: auto; 并将它放到块元素中 -->
<img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
</body>

在这里插入图片描述

CSS 导航栏

<head>
	<title>CSS 导航栏</title>
	<style type="text/css">
		body {
			margin: 0;
		}

		ul {
			list-style-type: none;
			margin: 0px;
			padding: 0px;
			width: 200px;
			height: 100%;
			/* 全屏高度 */
			background-color: #f1f1f1;
			position: absolute;
			overflow: auto;
			/* 如果导航栏选项多,允许滚动 */
		}

		li {
			text-align: center;
		}

		li a {
			text-decoration: none;
			color: #000000;
			padding: 8px 16px;
			display: block;
		}

		li a.active {
			background-color: #4CAF50;
			color: white;
		}

		/*鼠标移动到选项上修改背景颜色 */
		li a:hover:not(.active) {
			background-color: #555;
			color: white;
		}
	</style>
</head>

<body>
	<div>
		<ul>
			<li><a class="active" href="day01.html" target="iframe_main">主页</a></li>
			<li><a href="#news">新闻</a></li>
			<li><a href="#contact">联系</a></li>
			<li><a href="#about">关于</a></li>
		</ul>
	</div>

	<div style="position: fixed;margin:80px 320px;height:100%;">
		<iframe width="990px" height="600px" name="iframe_main"></iframe>
	</div>
</body>

在这里插入图片描述

CSS导航栏-水平导航栏


<head>
    <title>day11-CSS导航栏-水平导航栏</title>
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
        }
        ul {
            text-align: center;
            list-style-type: none;
            margin: 0;
            padding: 0;
        }
        li {
            display: inline;
        }

        li a {
            margin: 10px 20px;
            padding: 10px;
            text-decoration: none;
        }
        .active {
            background-color: #4CAF50;
            color: white;
        }

        a:hover {
            background-color: #555;
            color: white;
        }
        a:active {
            background-color: #4CAF50;
            color: white;
        }
    </style>
</head>

<body>
    <div>
        <ul>
            <li><a class="active" href="day07-position.html" target="iframe_name">主页</a></li>
            <li><a href="day08-overflow.html" target="iframe_name">新闻</a></li>
            <li><a href="day09-Float浮动.html" target="iframe_name">联系</a></li>
            <li><a href="#about">关于</a></li>
        </ul>
    </div>

    <div>
        <iframe width="1300px" height="600px" name="iframe_name"
            style="margin: 50px 60px;text-decoration: none;"></iframe>
    </div>
</body>

在这里插入图片描述

Opacity图片透明

<head>
	<title>Opacity图片透明</title>
	<style type="text/css">
		img{
			opacity: 0.4;
			width: 150px;
			height: 113px;
		}
		img:hover{
			opacity: 1.0;
		}
	</style>


</head>
<body>



<img class="img1" src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
<img src="http://cdn.panyucable.cn/zysheep/al1_top.jpg">
</body>

在这里插入图片描述

CSS3 渐变(Gradients)

<head>
	<title>CSS3 渐变(Gradients)</title>
	<style type="text/css">
		#grad1{
			height: 200px;
			background-color: red;
			background-image: linear-gradient(#e66465, #9198e5);

		}
		#grad2{
			height: 200px;
			background-color: red;
			background-image: repeating-radial-gradient(red, yellow 10%, green 15%);

		}
	</style>
</head>
<body>
<h3>线性渐变 - 从上到下</h3>
<p>从顶部开始的线性渐变。起点是红色,慢慢过渡到蓝色:</p>
<div id="grad1"></div>

<h3>线性渐变 - 从上到下</h3>
<p>从顶部开始的线性渐变。起点是红色,慢慢过渡到蓝色:</p>
<div id="grad2"></div>
</body>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李熠漾

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值