| | 157 | |
|---|
| | 158 | === Example RCSS === |
|---|
| | 159 | |
|---|
| | 160 | The following are the select element's RCSS rules and properties from the Rocket Invaders from Mars style sheet: |
|---|
| | 161 | |
|---|
| | 162 | {{{ |
|---|
| | 163 | /* Specify the dimensions of the select element. */ |
|---|
| | 164 | select |
|---|
| | 165 | { |
|---|
| | 166 | width: 175px; |
|---|
| | 167 | height: 37px; |
|---|
| | 168 | } |
|---|
| | 169 | |
|---|
| | 170 | /* Specify the dimensions of the value element within the select element. Padding is used to position the |
|---|
| | 171 | value correctly internally. */ |
|---|
| | 172 | select selectvalue |
|---|
| | 173 | { |
|---|
| | 174 | width: 125px; |
|---|
| | 175 | height: 28px; |
|---|
| | 176 | padding: 9px 10px 0px 10px; |
|---|
| | 177 | |
|---|
| | 178 | background-decorator: image; |
|---|
| | 179 | background-image: invader.png 162px 192px 307px 229px; |
|---|
| | 180 | } |
|---|
| | 181 | |
|---|
| | 182 | /* Animate the value field when it is hovered. */ |
|---|
| | 183 | select selectvalue:hover |
|---|
| | 184 | { |
|---|
| | 185 | background-image-t: 230px 267px; |
|---|
| | 186 | } |
|---|
| | 187 | |
|---|
| | 188 | /* Fix the size of the select arrow decorate the element. */ |
|---|
| | 189 | select selectarrow |
|---|
| | 190 | { |
|---|
| | 191 | width: 30px; |
|---|
| | 192 | height: 37px; |
|---|
| | 193 | |
|---|
| | 194 | icon-decorator: image; |
|---|
| | 195 | icon-image: invader.png 307px 192px 337px 229px; |
|---|
| | 196 | } |
|---|
| | 197 | |
|---|
| | 198 | /* Animate the arrow when hovered. */ |
|---|
| | 199 | select selectarrow:hover |
|---|
| | 200 | { |
|---|
| | 201 | icon-image-t: 230px 267px; |
|---|
| | 202 | } |
|---|
| | 203 | |
|---|
| | 204 | /* Animate the arrow when the button is pressed or the box is visible. */ |
|---|
| | 205 | select selectarrow:active, |
|---|
| | 206 | select selectarrow:checked, |
|---|
| | 207 | { |
|---|
| | 208 | icon-image-t: 268px 305px; |
|---|
| | 209 | } |
|---|
| | 210 | |
|---|
| | 211 | /* Fix the width of the select box and fiddle with the margins to get it in exactly the right place. */ |
|---|
| | 212 | select selectbox |
|---|
| | 213 | { |
|---|
| | 214 | margin-left: 1px; |
|---|
| | 215 | margin-top: -7px; |
|---|
| | 216 | width: 162px; |
|---|
| | 217 | padding: 1px 4px 4px 4px; |
|---|
| | 218 | |
|---|
| | 219 | background-decorator: tiled-box; |
|---|
| | 220 | background-top-left-image: invader.png 281px 275px 292px 284px; |
|---|
| | 221 | background-top-right-image: invader.png 294px 275px 305px 284px; |
|---|
| | 222 | background-top-image: invader.png stretch 292px 275px 293px 284px; |
|---|
| | 223 | background-bottom-left-image: invader.png 281px 285px 292px 296px; |
|---|
| | 224 | background-bottom-right-image: invader.png 294px 285px 305px 296px; |
|---|
| | 225 | background-bottom-image: invader.png stretch 292px 285px 293px 296px; |
|---|
| | 226 | background-left-image: invader.png stretch 281px 283px 292px 284px; |
|---|
| | 227 | background-center-image: invader.png stretch 292px 283px 293px 284px; |
|---|
| | 228 | } |
|---|
| | 229 | |
|---|
| | 230 | /* Sizes the option element to take up the available width in the select box. */ |
|---|
| | 231 | select selectbox option |
|---|
| | 232 | { |
|---|
| | 233 | width: auto; |
|---|
| | 234 | padding-left: 3px; |
|---|
| | 235 | } |
|---|
| | 236 | |
|---|
| | 237 | /* Specifies every second option in the selection box to have a white background. */ |
|---|
| | 238 | select selectbox option:nth-child(even) |
|---|
| | 239 | { |
|---|
| | 240 | background: #FFFFFFA0; |
|---|
| | 241 | } |
|---|
| | 242 | |
|---|
| | 243 | /* Gives the red highlight to the selection box. */ |
|---|
| | 244 | select selectbox option:hover |
|---|
| | 245 | { |
|---|
| | 246 | background: #FF5D5D; |
|---|
| | 247 | } |
|---|
| | 248 | }}} |