search
HomeWeb Front-endHTML TutorialSimple html css page production_html/css_WEB-ITnose

Today I will use html css to create the simplest page. The rendering is as follows:

Explanation: The Korean words here can be replaced with Chinese.

1. After getting the rendering, first analyze the page layout

The picture is a vertical structure, divided into 5 large DIVs:

The page width I made is 1024px , add a large box outside the 5 DIVs to a class named all. Set the width to 1024px and center it.

Generally, pages are done in order. This depends on personal habits. Since it is just one page, my css and HTML are written in the same page.

2. First write the first div and give it a class name top.

The css style is as follows:

The effect is as follows:

The first div is now ready.

3. Make the menu and logo below

css is as follows:

Rendering:

4. Make the submenu of menu

css is as follows:

Generally, the secondary menu can be made with js, I No JS is used here, CSS is used directly to position the first-level menu and the second-level menu, and the style (css in the rectangular frame in the picture) is used to control the hiding and display of the second-level menu. The disadvantage of writing this way is that it is not compatible with IE6. Other mainstream browsers like Google, Firefox and higher versions of IE are compatible.

5. It’s best to use banner, you can put pictures directly or set background.

is omitted here. 6. Analyze the main content. The fourth DIV

is divided into two layers. The first layer displays the news list, about us and product center, and the second layer displays logo copyright statement and a drop-down box

Because the content on the first layer is displayed side by side, these three DIV settings are like left floating.

In order from left to right, do the news section first

Style:

7. The picture is divided into left and right structures. Just let the picture float to the left, and the left and right structures will come out. I haven't encountered any problems with this way of writing yet.

The product center should be the shutter effect made with js. This is just the style for now. The effect will be added later. Add the bottom logo and other divs between the product center and the bottom logo and it will automatically go down.

The code is attached below:

<!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>html+css基本页面</title><style type="text/css">*{ margin:0; padding:0; font-size:12px; color:#464646;}a{ text-decoration:none;}ul li{ list-style:none;}.clear{clear: both;font-size: 1px;width: 1px;height: 0px;visibility: hidden;overflow: hidden;}/*.clear样式的作用是清除浮动*/.all{ width:1024px; margin:0 auto;}.top{ background:#404040; display:table; width:100%;}.top ul{ float:right; margin-right:30px;}.top ul li{ float: left; margin:0px 10px;}.top ul li a{ display:block; color:#c2c2c2; line-height:30px; margin:10px 0px; width:75px; text-align:center;}.top ul li a.a_hover{background:url(images/topa_bg.png) no-repeat;}.top ul li a:hover{background:url(images/topa_bg.png) no-repeat;}.header{ background:url(images/menu_bg.jpg) repeat-x;}.logo img{ display:block; margin:0px auto; padding-top:20px;}.menu{ display:table; margin:0 auto;}.menu ul li{ float:left; position:relative;}.menu ul li.li_line{ width:2px; background:url(images/li_linebg.png) no-repeat; height:44px;}.menu ul li a{ display:block; line-height:44px; width:150px; text-align:center; color:#000; font-size:14px;}.menu ul li a.menua_hover{ background:url(images/menua_hover.png) no-repeat; color:#fff;}.menu ul li a:hover{ background:url(images/menua_hover.png) no-repeat; color:#fff;}.menu ul li:hover ul{ display:table;}.menu ul li ul{ position:absolute; width:350px; padding-left:30px; left:15px; background:#001126; display:none;}.menu ul li ul li{ float:left;}.menu ul li ul li a{ width:80px; line-height:24px; color:#fff; font-size:12px;}.menu ul li ul li a:hover{ background:none; color:#246477;}.main{ padding:20px; background:url(images/bottombg.jpg); height:183px;}.news{ float:left; width:220px; margin:0px 20px;}.news dl dd{ float:left; color:#464646; font-size:14px; font-weight:bold; line-height:24px;}.news dl dt{ float:right; line-height:24px; background:url(images/newsdd_bg.jpg) no-repeat left center; padding-left:6px;}.news ul li{ line-height:22px;}.news ul li a{ background:url(images/newa_bg.jpg) no-repeat left center; padding-left:10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width:210px; display:block;} .about{ width:305px; display:table; margin:0px 20px; float:left;}.about img{ float:left; margin:20px;}.about img.view{ margin:5px 0px 0px 0px;}.about h3{ line-height:24px; margin-top:20px; color:#4380ab; font-size:16px;	}.about span{ line-height:20px; display:block;}.pro{ width:320px; float:left; border:1px solid #d7d7d7; display:table;}.pro ul{ float:left;}.pro ul.pro_ulview{ width:254px;}.pro ul.pro_ulview li{ float:left; background:none; width:157px; margin-right:10px;}.pro ul.pro_ulview li a.more{ margin:10px 0px 0px 20px; display:block;}.pro ul img.view{ margin-top:40px; }.pro ul img{ float:none; display:block;}.pro ul strong{ display:table; line-height:30px; margin-left:20px;}.pro ul span.view{ width:140px; display:block; margin-left:20px;}.pro ul li{ width:33px; height:112px; background:url(images/pro_libg.jpg);}.footer_logo{ float:left; margin:20px;}.footer_menu{ float:left; margin:5px 0px 0px 70px;}.footer_menu ul li{ float:left; width:102px; line-height:30px; text-align:center;}.footer_menu ul li.fli_line{ width:1px; background:url(images/fli_linebg.png) no-repeat; height:30px;}.footer_menu ul.bq{ margin-left:38px;}.footer_menu ul span{ line-height:22px; margin-right:10px; color:#7d7d7d;}.select{ float:right; margin-top:20px;}</style></head><body><div class="all">	<div class="top">		<ul>			<li><a href="#" class="a_hover">头部示例1</a></li>			<li><a href="#">头部示例2</a></li>			<li><a href="#">头部示例3</a></li>			<li><a href="#">头部示例4</a></li>		</ul>	</div>	<div class="clear"></div>	<div class="header">		<div class="logo">		<img src="/static/imghwm/default1.png"  data-src="images/logo.png"  class="lazy" alt="logo" />		</div>		<div class="menu">			<ul>			<li class="li_line"></li>				<li>					<a href="#" class="menua_hover">菜单1</a>					<ul>						<li><a href="#">二级菜单1</a></li>						<li><a href="#">二级菜单2</a></li>						<li><a href="#">二级菜单3</a></li>						<li><a href="#">二级菜单4</a></li>					</ul>				</li>			<li class="li_line"></li>				<li><a href="#">菜单2</a>					<ul>						<li><a href="#">二级菜单1</a></li>						<li><a href="#">二级菜单2</a></li>						<li><a href="#">二级菜单3</a></li>						<li><a href="#">二级菜单4</a></li>					</ul>					</li>			<li class="li_line"></li>				<li><a href="#">菜单3</a></li>			<li class="li_line"></li>				<li><a href="#">菜单4</a></li>			<li class="li_line"></li>				<li><a href="#">菜单5</a></li>			<li class="li_line"></li>				<li><a href="#">菜单6</a></li>			<li class="li_line"></li>			</ul>		</div>	</div>	<div class="clear"></div>	<div>		<img src="/static/imghwm/default1.png"  data-src="images/banner.jpg"  class="lazy" alt="banner" />	</div>	<div class="clear"></div>	<div class="main">		<div class="news">			<dl>				<dd>NEWS</dd>				<dt>more</dt>			</dl>			<div class="clear"></div>			<ul>			<li><a href="#">新闻示例1新闻示例1新闻示例1新闻示例1</a></li>			<li><a href="#">新闻示例2新闻示例2新闻示例2新闻示例</a></li>			<li><a href="#">新闻示例3新闻示例3新闻示例3新闻示例</a></li>			<li><a href="#">新闻示例4新闻示例4新闻示例4新闻示例</a></li>			</ul>		</div>		<div class="about">		<img src="/static/imghwm/default1.png"  data-src="images/about.png"  class="lazy" alt="about" />		<h3 id="ABOUT">ABOUT</h3>		<span>关于我们关于我们关于我们关于我们关于我们关于我们</span>		<a href="#"><img class="view lazy"  src="/static/imghwm/default1.png"  data-src="images/about_view.png"  alt="view"/></a>		</div>		<div class="pro">			<ul class="pro_ulview">			<li>			<strong>产品<span>案例1</span></strong>			<span class="view">产品简介产品简介产品简介产品简介产品简介产品简介产品简介产品简介</span>			<a href="#" class="more"><img src="/static/imghwm/default1.png"  data-src="images/about_view.png"  class="lazy" alt="view"/></a>			</li>			<img class="view lazy"  src="/static/imghwm/default1.png"  data-src="images/pro_img.png"  alt="pro"/>			</ul>			<ul>			<li></li>			</ul>			<ul>			<li></li>			</ul>		</div>		<div class="clear"></div>			<div class="footer_logo"><img src="/static/imghwm/default1.png"  data-src="images/footer_logo.png"  class="lazy" alt="footer_logo" /></div>			<div class="footer_menu">			<ul>			<li><a href="#">首页</a></li>			<li class="fli_line"></li>			<li><a href="#">关于我们</a></li>			<li class="fli_line"></li>			<li><a href="#">产品中心</a></li>			</ul>			<div class="clear"></div>			<ul class="bq"><span>版权所有@某某网站</span><span>联系电话:01234567890</span></ul>			</div>			<div class="select"><img src="/static/imghwm/default1.png"  data-src="images/select.jpg"  class="lazy" alt="select" /></div>	</div>	</div></body></html>

As for the pictures, just cut them out from the renderings if you need them.

This is my first time summarizing something like this, so please forgive me for any shortcomings. I hope I can communicate with everyone and make progress together.

Pages are generally divided into special effects pages and normal pages.

The layout is generally divided into menu LOGO, main content and copyright statement at the end.

The layout of the special effects page is uncertain. The layout of the ordinary page is generally divided into top, middle and bottom, and the middle part is divided into top and bottom structure or left and right structure. It will be easier to build the general frame first, and then fill it in bit by bit.

Finally, I will give you a reference website: http://www.w3school.com.cn/ which basically has everything you need for the front end. If you encounter problems, you can go there to find solutions. Highly recommended personally.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Mar 04, 2025 pm 12:32 PM

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

How do I use HTML5 form validation attributes to validate user input?How do I use HTML5 form validation attributes to validate user input?Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What are the best practices for cross-browser compatibility in HTML5?What are the best practices for cross-browser compatibility in HTML5?Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

How to efficiently add stroke effects to PNG images on web pages?How to efficiently add stroke effects to PNG images on web pages?Mar 04, 2025 pm 02:39 PM

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

What is the purpose of the <datalist> element?What is the purpose of the <datalist> element?Mar 21, 2025 pm 12:33 PM

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element?What is the purpose of the <meter> element?Mar 21, 2025 pm 12:35 PM

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

How do I use the HTML5 <time> element to represent dates and times semantically?How do I use the HTML5 <time> element to represent dates and times semantically?Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

What is the purpose of the <progress> element?What is the purpose of the <progress> element?Mar 21, 2025 pm 12:34 PM

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)