source: sipei/modules/views/help/theme-css.html @ ffa4103

drupal-6.x
Last change on this file since ffa4103 was ffa4103, checked in by Luis Peña <lpena@…>, 12 años ago

Cambiando el nombre de modulos a modules

  • Propiedad mode establecida a 100755
File size: 2.8 KB
Línea 
1<!-- $Id: theme-css.html,v 1.3 2008/07/01 22:34:25 merlinofchaos Exp $ -->
2Views uses a wide array of CSS classes on all of its content to ensure that you can easily and accurately select exactly the content you need in order to manipulate it with CSS.
3
4Typically, every view is wrapped in a div with the name of the view as part of its class (for all these examples, we will assume the name of the view is <strong>myview</strong>), as well as the generic class 'view':
5
6<pre>
7&lt;div class="view view-myview"&gt;
8...
9&lt;/div&gt;
10</pre>
11
12In your CSS, you can modify all views:
13
14<pre>
15div.view {
16  border: 1px solid black;
17}
18</pre>
19
20Or just your view:
21
22<pre>
23div.view-myview {
24  background: yellow;
25}
26</pre>
27
28By default, the general view template also provides the following classes to easily style other areas of the view:
29<ul>
30<li> .view-header </li>
31<li> .view-filters </li>
32<li> .view-content </li>
33<li> .view-empty (if an "empty" text is used when the view has no results) </li>
34<li> .view-footer </li>
35<li> .feed-icon </li>
36<li> .attachment-before (if using an "attachment" display)</li>
37<li> .attachment-after (if using an "attachment" display)</li>
38</ul>
39
40So for example:
41<pre>
42div.view-myview div.view-header {
43  /* make the header stand out */
44  font-size: 120%;
45  font-weight: bold;
46}
47
48div.view-myview div.view-footer {
49  /* Make the footer less important */
50  font-size: 80%;
51  font-style: italic;
52  color: #CCC;
53}
54</pre>
55
56In the above example, we whimsically made the header bold and in a bigger font, and the footer smaller, italicized, and greyish.
57
58<h3>Views with fields</h3>
59If your view has fields, each field is uniquely tagged with its ID. A field's ID may be gleaned from the Theme: Information page. Note that due to CSS rules, any _ in the id will be converted to - automatically, so if you have a field whose id is 'edit_node' (this is the field used to provide an "edit" link to a node), it will be 'edit-node'. Additionally, to make sure that the view IDs don't conflict with other css classes in the system, they will be pretended with 'views-field-'; thus, the final CSS class for the field with the id 'edit_node' will be <strong>views-field-edit-node</strong>.
60
61Exactly how this appears is going to depend upon the style you're using. For example, the 'unformatted' style uses <strong>div.views-field-edit-node</strong> and <strong>div.views-label-edit-node</strong> to access that particular field, but a table would use <strong>td.views-field-edit-node</strong> and <strong>th.views-field-edit-node</strong> to access the table header; or just <strong>.views-field-edit-node</strong> to affect both.
62
63<pre>
64.view-myview th {
65  color: red; /* make all headers red */
66}
67
68.view-myview .views-field-title {
69  font-weight: bold; /* Make the 'title' field bold */
70}
71
72.view-myview td.views-field-body {
73  font-size: 60%; /* Make the text in the body field small */
74}
75</pre>
76
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.