This is an old revision of the document!


Como personalizar cores, fontes e mais (codificação CSS)

Para maiores detalhes veja primeiro: customize Piwigo (em inglês)

Introdução

HTML (the Hypertext Markup Language) e CSS (Cascading Style Sheets) são duas das tecnologias usadas para construir páginas Web. HTML fornece a estrutura da página e CSS fornece o layout visual, para vários tipos de dispositivos.

A linguagem CSS (Cascading Style Sheets) é poderosa para personalizar sua galeria. Cores, fontes, posição dos elementos, etc podem ser modificados usando CSS.

Alguns tutoriais e websites úteis para aprender como usar CSS

O que é necessário

Isso depende do seu navegador:

  • Firefox : install the extension Firebug. Then press F12, or right-click to open the contextual menu and click on “Inspect this element”
  • Internet Explorer : press “F12”.
  • Opera : use Opera Dragonfly by pressing Ctrl + Maj + I on a Pc, or ⌘ + ⌥ + I for a Mac. You can also right-click to open the contextual menu and click on “Inspect the element”.
  • Chrome : press “F12”, and the icon magnifying glass to inspect an element.
  • Safari : go to Edition→Preferences→advanced et tick “Activate the dev menu…”. By doing that, you will have a new menu between Favorites et Windows. In there click on Display the web inspector”.

You might need to download several of these well-know browsers, because the render of a page may change according to the browser.

How To: como encontrar o seletor correto

Each HTML element is accessible through CSS by selector. Read Syntax and Id and Class to understand.

Here is an example of how you can easily access to the html/css code of any web page, and change it. With Firebug, a new windows appears in Firefox (see Fig.01).

Fig.01 Firebug Menu
Fig.01 Firebug Menu


Fig.01 illustrates the HTML tab, where you can visualize the content of any web page -on-line or off-line-. You see what the browser receives and interprets. This windows is split in 2 zones.

  1. The first one (on your left) contains the HTML code.
    Info : You can see on the screen-shot a blue zone on the page : the mouse is over the <tr> which corresponds to that blue zone highlighted by Firebug
  2. The second zone (on the right) gives all the CSS properties applied to the HTML element selected. It shows also the selector used to apply the properties on that HTML element, and where the code is located -in a file and on what lines-. You can change on the fly the properties, by clicking on value and/or the property. The changes are applied immediately and can be seen on the web page without refreshing

How To: como modificar a propriedade CSS do elemento

As we have seen, the value of any properties can be changed on-the-fly. The properties can be disabled, changed and created.

How To: como salvar as alterações no meu Piwigo

In the forum someone gave you a piece of CSS code ?

You have played with one of the tools previously mentioned, and you want to save your changes ?

You might have noticed that Firebug doesn't change the files : if you refresh the page, you will loose all your changes
If you follow that tutorial, you will NOT loose your changes during updates.

Go to [ Administration » Plugins » LocalFiles Editor]]1) » Tab ”CSS” ]
There you can choose in the drop-down menu between local-rules.css and a all the themes enable on your gallery.

  • local-rules.css is a file loaded by Piwigo whatever the theme : if your CSS change need to be applied to all themes, select it.
  • If you select a theme, the CSS code written will be loaded only for that theme. In most of the case, it's recommend to apply the CSS code to one theme.\\Info :For a parent theme, his *-rules.css file will be loaded for him-self and his child themes! So a child theme can have several local-rules files loaded.

Now just copy/past your CSS code and save. The effects should be seen immediately : if not, try to refresh the cache of your browser and purge the Purge compiled templates, in [ Tools » Maintenance» ]

Se você precisar adicionar comentários sobre o que o código faz, coloque duas barras antes do seu comentário para que essa linha não seja interpretada.

Exemplo:

// isso irá ocultar o menu da minha galeria
#menubar {
  display: none;
}

FAQ

É necessário copiar/colar todo o conteúdo do arquivo theme.css?

Com certeza não!
O código CSS em *-rules.css será aplicado por cima do CSS contido no arquivo padrão como no theme.css do tema que você está modsificando.

Onde minhas personalizações são salvas?

O arquivo CSS gerado pelo LocalFiles Editor são guardados na pasta:

./piwigo/local/css/

Eles são nomeados como *-rules.css, onde * é o nome do tema.

1) It needs to be activated!
 
Back to top
css_code.1393355531.txt.gz · Last modified: 2014/02/25 19:12 by msakik
 
 
github twitter newsletter Doar Piwigo.org © 2002-2024 · Contato