HTML如何制作一个简单的单页布局(代码分享)

html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

之前的文章《一步步教你使用CSS制作一个简单美观的导航栏(代码详解)》中,给大家介绍了怎样使用CSS制作简单美观的导航栏。下面本篇文章给大家介绍如何用html制作简单的面页布局,我们一起看看怎么做。

HTML如何制作一个简单的单页布局(代码分享)

互联网多数的网页都是由html编写的,html配合css布局做成一个简单的漂亮网页。

代码示例

<!DOCTYPE html>
<html>
<head>
<title>css网页布局 </title>
<meta charset="utf-8">

<style>
* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.header {
  background-color: #f1f1f1;
  }

.topnav {
  overflow: hidden;
  background-color: #f61137;
}

.topnav a {
  float: left;
  color: #0017f9;
  padding: 10px 100px;
  text-decoration: none;
}

.topnav a:hover {
 background-color:#7efe51;
 

</style>
</head>
	
	
<body>
<div class="responsive">
  <div class="img">
    <a target="_blank" href="/Uploads///static.runoob.com/images/demo/demo1.jpg">
      <img src="/Uploads///static.runoob.com/images/demo/demo1.jpg" alt="#" width="800" height="100">
    </a>
	  </div>
	</div>
 <div class="topnav">
  <a href="#">图片</a>
  <a href="#">视频</a>
  <a href="#">关于</a>
</div>

<div class="responsive">
  <div class="img">
    <a target="_blank" href="/Uploads///static.runoob.com/images/demo/demo4.jpg">
      <img src="/Uploads///static.runoob.com/images/demo/demo4.jpg" alt="#" width="800" height="500">
	</a>
	</div>
</div>
</body>
</html>

代码效果图如下:

02.jpg

代码步骤:

1、开始HTML 源码,<html>标签语言有【开始标签】和【结束标签】,中间为标签的内容,先我们输入头和尾。

<html>
</html>

2、一个简单的 HTML 文档,带有最基本的必需的元素。在中间加入标题</code>标签,在title标题中加入网页标题名:css面页布局,可以不写。</p><pre><<a href="/tag-news-name-html-p-1.html">html</a>> <head> <title>css网页布局 </title> </head> </<a href="/tag-news-name-html-p-1.html">html</a>></pre><p>3、网页布局<code><style></code> 标签用于为 <a href="/tag-news-name-HTML-p-1.html">HTML</a> 文档定义样式信息,创建高级的布局非常耗时,使用模板是一个快速的话,搜索引擎可以找到很多免费的网站模板。</p><pre><<a href="/tag-news-name-html-p-1.html">html</a>> <head> <title>css网页布局 </title> </head> <style>...网页布局... </style> </<a href="/tag-news-name-html-p-1.html">html</a>></pre><p>4、<code><body></code>元素包含文档的所有内容,比如:文本、超链接、图像、表格和列表等。</p><pre><<a href="/tag-news-name-html-p-1.html">html</a>> <head> <title>css网页布局</title> </head> <body> <p>body 元素的内容会显示在浏览器中。</p> <p>title 元素的内容会显示在浏览器的标题栏中。</p> </body> </<a href="/tag-news-name-html-p-1.html">html</a>></pre><p>推荐学习:<a href="/tag-news-name-Html-p-1.html">Html</a>视频教程</p> <p>以上就是<a href="/tag-news-name-HTML-p-1.html">HTML</a>如何制作一个简单的单页布局(代码分享)的详细内容,更多请关注www.sxiaw.com其它相关文章!</p> <button type="button" class="ask_text test-iframe-handle"> </button> </div> </article> <aside class="swnetnews"> <div class="lis"> <span><i>推荐内容</i></span> <ul> <li><a href="/doc/1726.html" title="xml数据岛绑定时的超链接处理的示例代码分享" target="_blank">xml数据岛绑定时的超链接处理的示例代码分享</a></li><li><a href="/doc/1813.html" title="解析golang中的mahonia乱码问题" target="_blank">解析golang中的mahonia乱码问题</a></li><li><a href="/doc/10827.html" title="讲解php怎么实现代码自动执行" target="_blank">讲解php怎么实现代码自动执行</a></li><li><a href="/doc/1350.html" title="golang如何限流?算法详解" target="_blank">golang如何限流?算法详解</a></li><li><a href="/doc/9894.html" title="PHP实现非法词汇过滤(算法分析)" target="_blank">PHP实现非法词汇过滤(算法分析)</a></li><li><a href="/doc/8739.html" title="看看PHP有哪四种方法实现交换两个整型变量" target="_blank">看看PHP有哪四种方法实现交换两个整型变量</a></li><li><a href="/doc/7640.html" title="PHP制作微信自定义分享" target="_blank">PHP制作微信自定义分享</a></li><li><a href="/doc/4884.html" title="控制反转原则,它和依赖注入有什么联系" target="_blank">控制反转原则,它和依赖注入有什么联系</a></li><li><a href="/doc/555.html" title="Django框架入门使用1.0" target="_blank">Django框架入门使用1.0</a></li><li><a href="/doc/3752.html" title="windows电脑如何将cpu性能开到最大" target="_blank">windows电脑如何将cpu性能开到最大</a></li> </ul> </div> </aside> </main> <script> // first, find all the div.code blocks document.querySelectorAll('pre').forEach(el => { // then highlight each hljs.highlightElement(el); hljs.lineNumbersBlock(el); }); </script> <link rel="stylesheet" type="text/css" href="/kan/css/basezb.css"> <script type="text/javascript" src="/kan/js/read.js"></script> <div style="display:none"> <div class="login-box" id="login-dialog"> <div class="login-top"><a rel="nofollow" id="login1" onclick="setTab('login',1,2);" >登录</a></div> <div class="login-form" id="nav-signin"> <!-- <div class="login-ico"><a rel="nofollow" class="qq" id="qqlogin" target="_blank" href="/user-center-qqlogin.html"> QQ </a></div> --> <div class="login-box-form" id="con_login_1"> <form id="loginform" action="/user-center-login.html" method="post" onsubmit="return false;"> <p class="int-text"> <input class="email" id="username" name="username" type="text" value="用户名或Email" onfocus="if(this.value=='用户名或Email'){this.value='';}" onblur="if(this.value==''){this.value='用户名或Email';};" ></p> <p class="int-text"> <input class="password1" type="password" id="password" name="password" value="******" onBlur="if(this.value=='') this.value='******';" onFocus="if(this.value=='******') this.value='';" > </p> <p class="int-info"> <label class="ui-label"> </label> <label for="agreement" class="ui-label-checkbox"> <input type="checkbox" value="" name="cookietime" id="cookietime" checked="checked" value="2592000"> <input type="hidden" name="notforward" id="notforward" value="1"> <input type="hidden" name="dosubmit" id="dosubmit" value="1">记住我的登录 </label> <a rel="nofollow" class="aright" href="/user-center-forgetpwd.html" target="_blank"> 忘记密码? </a></p> <p class="int-btn"><a rel="nofollow" id="loginbt" class="loginbtn"><span>登录</span></a></p> </form> </div> </div> </div> </div> </div> <script type="text/javascript" src="/kan/js/foot_js.js"></script> <div id="footer"> <div class="w1200"> <p class="tips_text">本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。</p> <p class="tips_text">Copyright © 2004-2018 https://www.sxiaw.com/. All Rights Reserved.<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?fa236be8ec7680639fbd4ee307fd0c69"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <a href="http://beian.miit.gov.cn/" target="_blank">津ICP备2023001793号-1</a></p> </div> </div> </body> </html>