• 仿慕课网教程html+css页面前段时间学习总结(1) fly


    刚刚开通了博客,来一篇写过的页面。

    先来个效果图:

    接下来直接上代码:

    HTML部分

    <!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>
    	<link href="css/main.css" rel="stylesheet" type="text/css"/>
    </head>
    	
    <body>
    	<div class="top">
    		<div class="top_content">
    			<ul>
    				<li><a href="#">联系我们</a></li>
    				<li><a href="#">加入收藏</a></li>
    				<li><a href="#">设为首页</a></li>
    			</ul>
    		</div>
    		
    	</div>
    	
    	<div class="wrap">
    	
    		<div class="logo">
    			<div class="logo_left">
    			<img src="images/logo.jpg" alt="慕课网"/>
    		</div>
    		<div class="logo_right">
    			<img src="images/tel.jpg" alt="服务热线"/><span class="tel">24小时服务热线:123-456-7890</span>
    		</div>
    		</div>
    		
    		<div class="nav">
    			<div class="nav_left">
    			
    			</div>
    			<div class="nav_mid">
    				<div class="nav_mid_left">
    					<ul>
    						<li><a href="#">首页</a></li>
    						<li><a href="#">关于慕课</a></li>
    						<li><a href="#">新闻动态</a></li>
    						<li><a href="#">课程中心</a></li>
    						<li><a href="#">在线课程</a></li>
    						<li><a href="#">人才招聘</a></li>
    					</ul>
    				</div>
    				<div class="nav_mid_right">
    					<form  action="" method="post">
    						<input class="search_text" type="text"/>
    					</form>
    				</div>
    			</div>
    			<div class="nav_right">
    			
    			</div>
    		</div>
    		
    		<div class="ad">
    			<ul>
    				<li><img src="images/ad2.jpg"/></li>
    			</ul>
    		</div>
    		
    		<div class="main">
    		
    			<div class="news">
    				<div class="title">
    					<h2 class="title_left">新闻中心</h2><span class="title_right"><a href="#">More>></a></span>
    				</div>
    				<div class="pic_news">
    					<img src="images/news.jpg"/><a href="#"><h2>520慕女神喊你来表白!</h2></a><p>活动时间:5月20日-5月25日<br/>获奖公布时间:5月26日<br/><a href="#">Learn More>></a></p>
    				</div>
    				<div class="news_list">
    					 <li><span class="date">2014-06-01</span> <a href="#">【慕客访谈 用户篇】“有为屌丝”在路上</a></li>
              			<li><span class="date">2014-06-01</span><a href="#">【有奖活动】给父亲的三行书信</a></li>
             			 <li><span class="date">2014-05-30</span><a href="#">《程序猿,请晒出你的童年》活动获奖公告</a></li>
              			<li><span class="date">2014-05-28</span><a href="#" title="aa">【慕课访谈】破茧成蝶——美女程序员的蜕变史</a></li>
            </ul>
    				</div>
    			</div>
    			
    			<div class="course">
    				<div class="title">
    					<h2 class="title_left">课程中心</h2><span class="title_right"><a href="#">More>></a></span>
    				</div>
    				<div class="course_pic">
    					<img src="images/css.jpg"/><a href="#"><h2>CSS圆角进化论</h2></a><p>CSS圆角的实现,经历了三大发展阶段:背景图片方式、CSS2.0+HTML标签模拟、CSS3.0圆角属性)。本案例详细讲解每一种的实现方式,并对实现的优缺点进行对比分析。</p>
    				</div>
    				<div class="course_type">
    					<ul>
    						<li>PHP开发</li>
    						 <li>前端开发</li>
    						 <li>JAVA开发</li>
    						 <li>Android开发</li>
    					</ul>
    				</div>
    			</div>
    			
    			<div class="sidebar">
    			  	<div class="video">
    					<div class="title"><h2 class="title_left">媒体聚集</h2></div>
    					<div class="video_content">
    					          <embed src="http://player.youku.com/player.php/sid/XNjkzMDE5MTUy/v.swf"  width="220" height="140" align="middle" ></embed>
    
    					</div>
    				</div>
    				<div class="sidebar_ad">
    					<img src="images/app.jpg"/>
    				</div>
    			</div>
    			
    		</div>
    		
    	</div>
    	
    	<div class="copyright">
    		<div class="copyright_content">
    			<ul>
    				<li><a href="#">关于</a>
    					<ul>
    						  <li><a href="#">品牌故事</a></li>
    						  <li><a href="#">联系我们</a></li>
    						  <li><a href="#">加入我们</a></li>
    						  <li><a href="#">版权声明</a></li>
    					</ul>
    				</li>
    				<li><a href="#">课程</a>
    					 <ul>
    						 <li><a href="#">PHP开发</a></li>
    						  <li><a href="#">前端开发</a></li>
    						  <li><a href="#">JAVA开发</a></li>
    						  <li><a href="#">Android开发</a></li>
            			</ul>
    				</li>
    				<li><a href="#">留言</a>
    					<ul>
    						<li><a href="#">意见反馈</a></li>
    						  <li><a href="#">问题留言</a></li>
    						  <li><a href="#">媒体联络</a></li>
    						  <li><a href="#">在线客服</a></li>
    					</ul>
    				</li>
    				<li><a href="#">关注</a>
    					<ul>
    						<li><a href="#">新浪微博</a></li>
    						  <li><a href="#">腾讯微博</a></li>
    						  <li><a href="#">企业微博</a></li>
    						  <li><a href="#">QQ空间</a></li>
    					</ul>
    				</li>
    				<li><a href="#"><img src="images/weixin.png"/>微信关注</a>
    					<ul>
    						<li><img src="images/qrcode.jpg"/></li>
    					</ul>
    				</li>
    			</ul>
    		</div>
    	</div>
    	
    </body>
    </html>

      CSS部分

    /*这里为了方便用了*通配符,实际项目中要有一个reset.css文件*/
    *{ margin:0; padding:0; font-size:12px; }
    body{ background-color:#F5F5F5; } /* top-css */ .top{ 100%; height:27px; background:url(../images/top_bg.jpg) repeat-x } .top_content{ 1000px; margin:0 auto; } .top_content li{ list-style-image:url(../images/li_bg.gif); float:right; 70px; line-height:27px; } .top_content a:link,.top_content a:visited{ color:#8E8E8E; text-decoration:none; } .top_content a:active,.top_content a:hover{ color:#900; text-decoration:none; } /* wrap-css */ .wrap{ 1000px; margin:0 auto; } /* logo-css */ .logo{ height:80px; background-color:#FFF; } .logo_left{ 200px; float:left; } .logo_right{ 300px; float:right; height:28px; margin-top:26px; color:#8E8E8E; } .logo_right img{ vertical-align:middle; margin-right:10px; } .tel{ font-family:"微软雅黑", "宋体"; font-size:16px; color:#C00; } /* nav-css */ .nav{ height:40px; } .nav_left{ 10px; background:url(../images/nav_left.jpg) no-repeat; } .nav_mid{ 980px; background:url(../images/nav_bg.jpg) repeat-x; } .nav_right{ 10px; background:url(../images/nav_right.jpg) no-repeat; } .nav_left,.nav_mid,.nav_right{ float:left; height:40px; } .nav_mid_left,.nav_mid_right{ float:Left; } .nav_mid_left{ 680px; } .nav_mid_right{ 300px; } .nav_mid_left li{ float:left; list-style-type:none; 100px; text-align:center; line-height:40px; } .nav_mid_left a:link,.nav_mid_left a:visited{ text-decoration:none; color:#FFF; font-size:16px; font-family:"微软雅黑", "宋体"; } .nav_mid_left a:hover,.nav_mid_left a:active{ color:#FF0; text-decoration:none; font-size:16px; font-family:"微软雅黑", "宋体"; } .search_text{ 190px; height:25px; margin-top:5px; background:url(../images/search.jpg) no-repeat right center; background-color:#FFF; padding-right:25px; border:1px solid #FFF; } /*ad-css */ .ad{ height:310px; overflow:hidden; } /* main-css */ .main{ height:250px; background:#FFF; margin-top:5px; } .news{ 340px; border:1px solid #E8E8E8; } .course{ 410px; border:1px solid #E8E8E8; margin:0 7px; } .sidebar{ 230px; } .news,.course,.sidebar{ height:250px; float:left; } .title{ height:35px; border-bottom:2px solid #E8E8E8; } .title_left{ 70%; font-family:"微软雅黑", "宋体"; font-size:14px; font-weight:bold; color:#786F66; float:left; line-height:35px; padding-left:20px; } .title_right{ 20%; float:right; line-height:35px; text-align:right; padding-right:10px; } .pic_news{ height:80px; margin-top:10px; line-height:22px; } .pic_news img,.course_pic img{ float:left; margin:0 5px; } .pic_news a,.course_pic a{ color:#C00; text-decoration:none; } .news_list{ margin-top:20px; } .news_list li{ list-style-image:url(../images/list.jpg); margin:2px; border-bottom:1px dotted #CCC; } .news_list a:link,.news_list a:visited{ text-decoration:none; color:#000; } .news_list a:hover,.news_list a:active{ color:#F00; } .date{ float:right; } .course_pic{ height:120px; line-height:22px; margin-top:10px; } .course_type{ height:37px; 372px; background:url(../images/product_type_bg.jpg) no-repeat; margin:20px auto; } .course_type li{ list-style-type:none; float:left; line-height:37px; margin:0 15px; text-align:center; } .video{ height:185px; border:1px solid #E8E8E8; } .video_content{ height:150px; } .sidebra_ad{ height:55px; border:1px solid #E8E8E8; margin-top:10px; } .copyright{ 100%; height:200px; background:#E8E8E8; margin-top:10px; } .copyright_content{ 1000px; margin:0 auto; padding-top:20px; } .copyright_content li{ list-style-type:none; float:left; 200px; background:url(../images/line.png) no-repeat right center; text-align:center; line-height:30px; font-family:"微软雅黑", "宋体"; } .copyright_content a{ text-decoration:none; color:#999; font-size:18px; } .copyright_content ul ul a{ font-size:14px; }

      到这里,一个简单的页面就写好了。

  • 相关阅读:
    SOG Tactical Tomahawk F01T 飞虎
    90 压缩干粮 飞虎
    美国陆军国民警卫队不锈钢水瓶 ACU色 飞虎
    CentOS安装RabbitMQ
    如何将EXCEL表中的数据导入数据库中
    Silverlight中的WattingDialog
    WPF ProgressDialog
    DataGrid小扩展
    WPF报表控件
    Misc另外一个世界
  • 原文地址:https://www.cnblogs.com/flytime/p/6811861.html
Copyright © 2020-2023  润新知