YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

YUI Library Home

YUI Library Examples: Layout Manager: Skinning a Layout

Layout Manager: Skinning a Layout

Layout skinning is done via CSS. The Layout Manager comes with a default skin, but you can extend or override this as needed.

Layout Managers core CSS file

The Layout Manager's base class is a starting point for skinning a Layout. Include this file and use the skin file as a reference for your new skin (you can view the full contents of the base class here).

Sam's skin CSS file

Once you have the base class in place, you can proceed to customize the look and feel of your Layout by working with the skinning file. Starting with the Sam Skin version below is generally the fastest approach, allowing you to customize just those parts of the skin that will make your implementation resonate with the overall design of your application.

1/* Remove the dotted border on the resize proxy */ 
2.yui-skin-sam .yui-layout .yui-resize-proxy { 
3    bordernone
4    font-size0
5    margin0
6    padding0
7} 
8/* During resize, hide the handles */ 
9.yui-skin-sam .yui-layout .yui-resize-resizing .yui-resize-handle { 
10    opacity0
11    filteralpha(opacity=0); 
12} 
13/* Style the div inside the resize proxy */ 
14.yui-skin-sam .yui-layout .yui-resize-proxy div { 
15    positionabsolute
16    border1px solid #808080
17    background-color: #EDF5FF; 
18} 
19/* Set the color of the Active resize handle */ 
20.yui-skin-sam .yui-layout .yui-resize .yui-resize-handle-active { 
21    background-color: #EDF5FF; 
22} 
23/* Styles for the left handle */ 
24.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-l { 
25    width5px
26    height100%
27    top0
28    left0
29} 
30/* Styles for the right handle */ 
31.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-r { 
32    width5px
33    top0
34    right0
35    height100%
36} 
37/* Styles for the bottom handle */ 
38.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-b { 
39    width100%
40    bottom0
41    left0
42    height5px
43} 
44/* Styles for the top handle */ 
45.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-t { 
46    width100%
47    top0
48    left0
49    height5px
50} 
51 
52/* Left Collapse button */ 
53.yui-skin-sam .yui-layout .yui-layout-unit-left div.yui-layout-hd .collapse { 
54    backgroundtransparent url(layout_sprite.png) no-repeat -20px -160px
55    border1px solid #808080
56} 
57/* Left Collapsed Expand Button */ 
58.yui-skin-sam .yui-layout .yui-layout-clip-left .collapse { 
59    backgroundtransparent url(layout_sprite.png) no-repeat -20px -140px
60    border1px solid #808080
61} 
62/* Right Collapse Button */ 
63.yui-skin-sam .yui-layout .yui-layout-unit-right div.yui-layout-hd .collapse { 
64    backgroundtransparent url(layout_sprite.png) no-repeat -20px -200px
65    border1px solid #808080
66} 
67/* Right Collapsed Expand Button */ 
68.yui-skin-sam .yui-layout .yui-layout-clip-right .collapse { 
69    backgroundtransparent url(layout_sprite.png) no-repeat -20px -120px
70    border1px solid #808080
71} 
72/* Top Collapse Button */ 
73.yui-skin-sam .yui-layout .yui-layout-unit-top div.yui-layout-hd .collapse { 
74    backgroundtransparent url(layout_sprite.png) no-repeat -20px -220px
75    border1px solid #808080
76} 
77/* Top Collapsed Expand Button */ 
78.yui-skin-sam .yui-layout .yui-layout-clip-top .collapse { 
79    backgroundtransparent url(layout_sprite.png) no-repeat -20px -240px
80    border1px solid #808080
81} 
82/* Bottom Collapse Button */ 
83.yui-skin-sam .yui-layout .yui-layout-unit-bottom div.yui-layout-hd .collapse { 
84    backgroundtransparent url(layout_sprite.png) no-repeat -20px -260px
85    border1px solid #808080
86} 
87/* Bottom Collapsed Expand Button */ 
88.yui-skin-sam .yui-layout .yui-layout-clip-bottom .collapse { 
89    backgroundtransparent url(layout_sprite.png) no-repeat -20px -180px
90    border1px solid #808080
91} 
92/* Close Button */ 
93.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd .close { 
94    backgroundtransparent url(layout_sprite.png) no-repeat -20px -100px
95    border1px solid #808080
96} 
97 
98/* Give the header a blue backgorund */ 
99.yui-skin-sam .yui-layout .yui-layout-hd { 
100    background:url(sprite.png) repeat-x 0 -1400px
101    border1px solid #808080
102} 
103/* Set the background color */ 
104.yui-skin-sam .yui-layout { 
105    background-color: #EDF5FF; 
106} 
107/* Style the text in the header */ 
108.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd h2 { 
109    font-weightbold
110    color: #fff; 
111    padding3px
112} 
113/* Style the body */ 
114.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd { 
115    border1px solid #808080
116    border-bottomnone
117    border-topnone
118    *border-bottom-width0
119    *border-top-width0
120    background-color: #f2f2f2
121    text-alignleft
122} 
123/* Add a border to the bottom of the body because there is no footer */ 
124.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd-noft { 
125    border-bottom1px solid #808080
126} 
127/* Add a border to the top of the body because there is no header */ 
128.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd-nohd { 
129    border-top1px solid #808080
130} 
131 
132/* Style the Clip */ 
133.yui-skin-sam .yui-layout .yui-layout-clip { 
134    positionabsolute
135    height20px
136    background-color: #EDF5FF; 
137    displaynone
138    border1px solid #808080
139} 
140/* Style the footer */ 
141.yui-skin-sam .yui-layout div.yui-layout-ft { 
142    border1px solid #808080
143    border-topnone
144    *border-top-width0
145    background-color: #f2f2f2
146} 
147 
148/* Remove the color from the resize handle */ 
149.yui-skin-sam .yui-layout-unit .yui-resize-handle { 
150    background-colortransparent
151} 
152/* Reposition the handles */ 
153.yui-skin-sam .yui-layout-unit .yui-resize-handle-r { 
154    right0
155    top0
156    background-imagenone
157} 
158.yui-skin-sam .yui-layout-unit .yui-resize-handle-l { 
159    left0
160    top0
161    background-imagenone
162} 
163.yui-skin-sam .yui-layout-unit .yui-resize-handle-b { 
164    right0
165    bottom0
166    background-imagenone
167} 
168.yui-skin-sam .yui-layout-unit .yui-resize-handle-t { 
169    right0
170    top0
171    background-imagenone
172} 
173/* Add the gripper */ 
174.yui-skin-sam .yui-layout-unit .yui-resize-handle-r .yui-layout-resize-knob, 
175.yui-skin-sam .yui-layout-unit .yui-resize-handle-l .yui-layout-resize-knob { 
176    positionabsolute
177    height16px
178    width6px
179    top45%
180    left0px
181    backgroundtransparent url(layout_sprite.png) no-repeat 0 -5px
182} 
183/* Add the gripper */ 
184.yui-skin-sam .yui-layout-unit .yui-resize-handle-t .yui-layout-resize-knob, 
185.yui-skin-sam .yui-layout-unit .yui-resize-handle-b .yui-layout-resize-knob { 
186    positionabsolute
187    height6px
188    width16px
189    left45%
190    backgroundtransparent url(layout_sprite.png) no-repeat -20px 0
191} 
view plain | print | ?

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

Copyright © 2011 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings