Web Standard Layout Example tutorial, easy to solve CSS complex layout with positioning _css/html

Source: Internet
Author: User
I believe that the classic forum to learn the standard of friends, 99% is not to enter the world, not to become a professional researcher, then what is the purpose of the people to come? Very simple, in fact, all want to pass the standard study to let oneself add a skill only, let oneself in looking for a job when not in be "need to master Web Standard" and baffled, in the following example XHTML does not have what semantics, the purpose of the article is just let everybody can better grasp the CSS in the relative, The use of absolute positioning (novice Ask this question is really a lot), and how to effectively combine the background, to achieve a more complex layout. Shortcomings also hope that predecessors can guide twos, thanks!

--------------------------------------------------the first step-------------------------------------------

First, casually design a complex layout of the (layout is not regular) Demo:
document.body.clientwidth-300) {this.height= (document.body.clientwidth-300) *this.height/this.width;this.width= DOCUMENT.BODY.CLIENTWIDTH-300} "border=0>

--------------------------------------------------the second step-------------------------------------------
We're going to write the code.


<title>Model</title>






------------------------------------------------------------------------------> How does this menu work?
How can a picture be implemented in a background switch?
Oh, it is also very simple? You know the background image is: Image horizontal ordinate position settings, this example is the use of this feature, will have a different ID of link a background offset to achieve the purpose of background switching.












-----------------------------------------------actual page effect:---------------------------------------
<HTML> <HEAD> <TITLE>model</TITLE> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <style> html,body{margin:0; padding:0; Background: #A1A9B6 URL (http://www.okrmt.com/demo7.8/images/allbg.jpg); Text-align:center; } #main {margin:0 auto; position:relative; width:780px; height:659px; Background:url (http://www.okrmt.com/demo7.8/images/model.jpg) no-repeat; } #main #menu {position:absolute; right:12px; width:354px; height:115px; Background:url (http://www.okrmt.com/demo7.8/images/menu.gif) no-repeat; } #main #menu A, #main #menu a#page{float:left; width:112px; height:30px; } #main #menu a#about{width:80px; height:55px; } #main #menu a#services{width:70px; height:80px; } #main #menu a#contacts{width:80px; height:115px; } #main #menu a:hover{background:url (http://www.okrmt.com/demo7.8/images/menu.gif) No-repeaT } #main #menu a#page:hover{background-position:0px-115px; } #main #menu a#about:hover{background-position: -112px-115px; } #main #menu a#services:hover{background-position: -192px-115px; } #main #menu a#contacts:hover{background-position: -262px-115px; } #main h1{Position:absolute; top:0;left:1px; width:151px; height:56px; Background:url (http://www.okrmt.com/demo7.8/images/logo.jpg) no-repeat; } #main h2{Position:absolute; top:133px; right:7px; width:404px; height:190px; Background:url (http://www.okrmt.com/demo7.8/images/about.gif) no-repeat; } #main h6{Position:absolute; bottom:75px; right:10px; width:265px; height:44px; Background:url (http://www.okrmt.com/demo7.8/images/cars-logo.gif) no-repeat; } </style> </HEAD> <BODY> <p></p> <p></p> <p></p> < /body> </HTML>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
Well, this time the example tutorial is over, I hope that the future of the XHTML Web page design, layout can help! Good bye.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.