- Install Google Chrome(Firefox works but too but the steps are different) if you do not already have it installed
- Load up your forum with the theme you wish to edit.
- Navigate to the page and the section where you wish to make a change
- Right Click on the element you wish to change (For Exp lets change the color of the rules text)
- In the menu that comes up click Inspect
This will open the Google Chrome Developer Tools. Its an in browser editor that tells you everything about how a page is rendered and allows you to make changes to it.
- You can customize the display of it to be docked in the browser at the top or side, or in a new window like the above screenshot by clicking the menu icon in the top right
- There are two sections to it the left side is the html for the page. You will see a highlighted line which is the line related to what you right clicked on in your browser. You may need to refine this by manually selecting the specific html you want to edit in this window.
- The right side displays all the css related to the selected html tag. Its in a tree type fashion as css is a cascading language which means that it inherits. Each class here is layered from bottom to top most layer. This may be confusing as it also has to do with something called specificity. This is just a big word that means weight given to a type of css selector.
- You will notice that in our example the top most css is applied to the html tag itself as this has the highest specificity. There are a couple of these, but If we work our way down we find
div.rules
- This class is applying a background color and a text color. This seems to be what we are looking to edit.
- On the right side you will see something that looks like
colours.css:306
This is telling us that you can find this rule on line 306 of the colours.css file. - Also of note if you look just above the class you should see a grey bar with the text
Inherited from div.rules
This is because if you look at the html you will see that we have<strong>Forum rules</strong>
selected, which is in a div with the class ofinner
, which is in a div with the class ofrules
. This is telling us that all text in this div is colored by this class. So if we just want to effect the color of the specific tag we have selected we need to create a new class. - It is my recommendation that if you are making any edits or changes to a theme that you do so none destructively via a new css file. You should also never edit prosilver directly, start by duplicating the theme and renaming it to prevent issues with upgrading
- Start by duplicating the prosilver folder and renaming it to whatever you want the theme called.
- In the new folder open
style.cfg
and changename = prosilver
to bename = whatever you want the theme called
- Now you should have a new theme that you can install in the acp and switch to.
- Next in this new folder create a new css file in the
theme
sub folder. You can call it whatever you want but i prefer to name it the same name as the theme. - Open the
stylesheet.css
file. - Duplicate the last line of
@import url("responsive.css?v=3.3");
and changeresponsive
to the name of the new css file you just created. - Now we have a clean workspace to make changes. So lets go back to our example. In the new css file lets say we just wanted to change the color of all the text from red to blue. so we copy the entire class from
colours.css
fordiv.rules
into our new css file and change the color from red to blue. Then save and clear the cache. - You should now have blue text
- Now les say you only wanted to change the color of the header text that we originally selected without changing the rest of the text.
- The easiest way would be to add a class in the html file. This is where things can get tricky because the chome developer tools does not provide what html file we are working from. So you would have to track it down usually by searching for the closest class in the html files, but this would shows us that rules block is coded in 4 different files. We would have to edit all these occurences.
- This is where most of the skilled css gurus would resort to doing something like the following which will work, but is rather hacky. (#note we are working to fix it in the future so that you should only have to edit the css but it means we would have to build a new theme from scratch! which takes a lot of coordination and time)
or
Code: Select all
div.rules strong:first-of-type { color: #2a55bc; }
Code: Select all
div.rules .inner > strong { color: #2a55bc; }
Hope this helps Cheers!