HTML学习12:其他常见标签之头标签_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:34:19
原创
1064人浏览过

       头标签都放在

头部分之间。包括:title标签,base标签,meta标签,link标签,style标签和script

标签(这个标签也可以放在体部分中)。

       一

标签 <p>       </p> <title>是成对出现的,作用是显示网页标题,指定浏览器的标题栏显示的内容。是head标签中唯一要求包 <p>含的东西。</p> <p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p> <p></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><html> <head> <title>这是我的第一个网页</title> </head> <body> </body></html></pre><div class="contentsignin">登录后复制</div></div>        浏览器显示的结果为: <p></p> <p><br></p> <p>        二<link>标签</p> <p>        link标签必须置于head里,定义文档与外部资源的关系。比如:链接样式表,引入样式文件。</p> <p>        href属性:被链接文档的地址。</p> <p>        rel属性:描述当前文档与被链接文档的关系。</p> <p>        type属性:规定被链接文档的类型。</p> <p>        media属性:指定被链接文档在哪种设备上起作用,也就是显示在什么设备上。</p> <p>        HTML代码:<br></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><html> <head> <title>这是我的第一个网页</title> <link rel="stylesheet" style="text/css" href="a.css" /> </head> <body> <p>这是一个段落</p> </body></html></pre><div class="contentsignin">登录后复制</div></div>        CSS代码: <br> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode">/* CSS Document */p {background-color:#000000;color:#FF0000;}</pre><div class="contentsignin">登录后复制</div></div>        浏览器显示的结果为: <p></p> <p><br></p> <p>        我们在这里再说一个外部延伸,就是设置地址栏图片:</p> <p>        方法1:favicon.ico放置在网站的根目录。一般适用于大中型网站。</p> <p>        方法2:放在head内,使用link标签引入。一般适用于小型网站,个人博客等网站。</p> <p>        演示:<br></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><html> <head> <title>这是我的第一个网页</title> <link rel="stylesheet" style="text/css" href="a.css" /> <link rel="shortcut icon" type="imag/x-icon" href="5.jpg" /> </head> <body> <p>这是一个段落<p> </body></html></pre><div class="contentsignin">登录后复制</div></div>        CSS代码同上。 <p></p> <p>        显示结果为:</p> <p><br></p> <p>        三<base>标签</p> <p>        必须置于head里。</p> <p>        href属性:指定网页中所有的超链接的目录。可以是本地目录,也可以是网络目录。注意值的结尾处一定要用/表</p> <p>示目录。只作用于相对路径的超链接文件。定义默认链接地址。</p> <p>       target属性:指定默认打开超链接的方式。如_blank表示所有的超链接都用新窗口打开显示。</p> <p></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><html> <head> <!--link标签链接外部样式表--> <link rel="stylesheet" type="text/css" href="a.css" /> <!--link标签链接标题栏图标--> <link rel="shortcut icon" type="imag/x-icon" href="5.jpg" /> <!--base标签链接默认地址,指定默认打开方式--> <base href="https://www.baidu.com" target="_blank" /> <title>这是我的第一个网页</title> </head> <body> <p>这是一个段落</p> <a href="">百度一下,你就知道</a> </body></html></pre><div class="contentsignin">登录后复制</div></div>         浏览器显示的结果为: <p></p> <p><br></p> <p>        四<meta>标签:</p> <div class="aritcle_card"> <a class="aritcle_card_img" href="/ai/2179"> <img src="https://img.php.cn/upload/ai_manual/000/000/000/175680176330664.png" alt="慧中标AI标书"> </a> <div class="aritcle_card_info"> <a href="/ai/2179">慧中标AI标书</a> <p>慧中标AI标书是一款AI智能辅助写标书工具。</p> <div class=""> <img src="/static/images/card_xiazai.png" alt="慧中标AI标书"> <span>120</span> </div> </div> <a href="/ai/2179" class="aritcle_card_btn"> <span>查看详情</span> <img src="/static/images/cardxiayige-3.png" alt="慧中标AI标书"> </a> </div> <p>        必须置于head里,作用是提供有关页面的元信息,其属性定义了与文档相关联的名称/值对。</p> <p><br></p> <p>        http-equiv属性:把content属性关联到HTTP头部,模拟HTTP协议的响应消息头。</p> <p><br></p> <p>        其他的关于http-equiv的内容:</p> <p><br></p> <p>        name属性:把content属性关联到一个名称,网页的描述信息。当取keywords时,content属性的内容就作为搜</p> <p>素引擎的关键字进行搜索。</p> <p><br></p> <p>        示例图片:</p> <p><br></p> <p>        scheme属性:定义用于翻译content属性值的格式,这个不常用。</p> <p>        以上的总的HTML代码:<br></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><html> <head> <!--指定网页文档解析为中文--> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <!--指定5秒后页面跳转到新浪网站--> <meta http-equiv="refresh" content="5;url='http://www.sina.com.cn/'" /> <!--下面两个标签是SEO搜素优化起到的作用,网站关键词和网站描述--> <meta name="keywords" content="前端开发,Web开发,HTML" /> <meta name="description" content="演示网页开发的文档" /> <!--link标签链接外部样式表--> <link rel="stylesheet" type="text/css" href="a.css" /> <!--link标签链接标题栏图标--> <link rel="shortcut icon" type="imag/x-icon" href="5.jpg" /> <!--base标签链接默认地址,指定默认打开方式--> <base href="https://www.baidu.com" target="_blank" /> <title>这是我的第一个网页</title> </head> <body> <p>这是一个段落</p> <a href="">百度一下,你就知道</a> </body></html></pre><div class="contentsignin">登录后复制</div></div>        显示结果为只有上传到服务器端才有功能显示,在SEO搜索优化的时候也会出现相应的内容。 <p></p> <p>        五<style>标签</style></p> <p>        置于head里,为HTML文档定义样式信息。这个我们在CSS中会具体地提到和讲解。</p> <p>        style属性:</p> <p><br></p> <p>        media常见的属性:</p> <p><br></p> <p>        HTNL代码:</p> <p></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>标签演示</title><style type="text/css">p {color:#0000FF;font-size:20px;</style></head><body> <p>这是一个段落</p></body></html></pre><div class="contentsignin">登录后复制</div></div>        显示结果为: <p></p> <p><br></p> <p>        六<script>标签:</script></p> <p>        可置于head里,也可以置于body里。定义客户端脚本或者引入脚本。这个我们在JavaScript中具体的讲解。</p> <p>        script的属性内容:<br></p> <p class="sycode">    </p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>标签演示</title><script type="text/javascript"> alert('hello');</script>></head><body></body></html></pre><div class="contentsignin">登录后复制</div></div>        显示结果为: <p></p> <p><br></p> <p><br><br><br></p> <br><br>。 <p class="sycode"> </p> <p>版权声明:本文为博主原创文章,未经博主允许不得转载。</p>
HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号