ArticleDirectory
- Very good page creation method
Very good page creation method
I have been working on the front-end for a few years. I dare not say I can show him more clearly, but I still have something of my own. For production, I divide a page into four layers: Framework, layout, module, list, and data block.
I. Framework
The page framework is basically "Header", "subject", and "tail ". However, for some pages such as tudou.com, a "menu" should also be added under the "Header" due to layout requirements ".
Ii. layout (# ID indicates the page element below)
# Head and # foot won't be mentioned. For details, refer to the demo page source code.
The layout refers to dividing the content in # Main into several blocks. Let's take a look at tudou.com, # The typical left and right structures in Main. We use # layout_1, # layout_2.
Iii. Modules
Layout # layout_1, # Blocks in layout_2 are modules,
In my understanding, the module must have at least one ID, and the class should be designed based on the page to add to the need for reuse.
For the module ID name, you need to get a meaningful name. To be lazy, you can use # col_1, # col_2 ,...
The Class Name of the module uses. cols_1,. cols_2 ,...
For example
Iv. List and data block
The module body consists of a list, and the list contains data blocks.
According to my understanding, the information on the page is actually different types of lists. We should extract the signature formula and put it in the public sample (public.css ).
Taking tudou.comas an example, the list defined in public.css must have at least three types:
1. List-V vertical list (vertical arrangement of images and text)
2. List-H horizontal list (horizontal arrangement of images and text)
3. List-T text list
Data blocks are actually a disguised Application of Micro-templates, which defines a fixed structure for different data elements.
The data blocks to be defined for tudou.com are:
1. mvideo (video)
2. MList (bean ticket)
3. Muser)
For example, mvideo should be like this:
<Div class = "mvideo">
<Div class = "p"> <a href = "" Title = ""> </ a> </div>
<Div class = "D">
<Div class = "d_name"> <a href = "" Title = ""> Allianz is expected to launch the Bulls </a> </div>
<Div class = "d_user"> <a href = "" Title = ""> Allianz is expected to launch the Bulls </a> </div>
<Div class = "d_length"> 068 </div>
<Div class = "d_time"> Release Date: <span> </div>
<Div class = "d_intro"> Allianz and colorfulness </div>
<Div class = "d_honor"> honor: <span> </span> </div>
<Div class = "d_view"> popularity: <span> 222 </span> </div>
<Div class = "d_comment"> comment: <span> 323 </span> </div>
<Div class = "d_favorite"> favorites: <span> 32 </span> </div>
<Div class = "d_type"> type: <span> <a href = "" Title = ""> maid </a> <a href = "" Title = "> maid </A> </span> </div>
<Div class = "d_tag"> tag: <span> <a href = "" Title = ""> twins </a> <a href = "" Title = "> N has been transferred» á</A> </span> </div>
<Div class = "d_subject"> topic: <span> <a href = "" Title = ""> ± ¬ ágou </a> </span> </div>
</Div>
</Div>
Finally, a keyword table is attached, that is, some IDs and class names used for public definitions.
ID
1. # use B-* // body
2. # Head, # Main, # foot // layout ID
3. # message // For system messages
4. # logo, # toolbar, # search, # menu // elements in the head
5. # layout _ *, # group _ *, # Col _ * // elements in main
6. # links, # copyright // elements in foot
7. # B * // ad space, used in combination with class = "B"
8. # Use plugin // banner
Class
1 .. TXT ,. BTN ,. label_checkbox ,. label_input ,. handle // elements in the form
2 .. meat // Module main element
3 .. LIST _*(. list_v ,. list_h ,. list-T ,. list_top ,...) // List element. For details, see "list"
4 .. M // more, which can be extended to the element "definitely positioned in the upper right corner"
5 .. s1 ,. s2 ,... // Used for the elements that the child unit blocks need to define their own styles, such as menus and rankings
6 .. S // special element. If an element is special to a sibling node, use
7 .. B // ad space
8 .. P ,. D ,. D _*,. h // the elements in the data block, including the image, detailed, detailed inner elements, and Operations
9 .. handle // operation element
10 .. M _*(. mvideo ,. mcomment ,. muser ,. msubject ,...) // Data block element
11 .. * _ fix // * patch element of the element
12 .. current // current element