View Full Version : How to add CSS tag properly in vb4
angedelamort
12-31-2009, 08:13 PM
Hello,
I'm testing some functionality and since I'm not to used with the news "style" system I was wondering what is the right way to add custom CSS style:
<style>
.styleName div { border:ridge; }
</style>
so when I use it somewhere else, I can do
<div class="styleName">...</div>
Thanks
Lynne
12-31-2009, 10:59 PM
You can add it to a css template you create and add yourself to the page or to an existing css template or to the <head> of the page. There are many ways to do it, it's kind of up to your situation and what is best for you.
consolegaming
01-01-2010, 12:15 AM
The approach I took personally was to create a custom template called style.css or whatever and then I added that to the list of css files that the headinclude template calls (there's a line with about 10 different css files being listed and I just added my custom one to the end of that).
Means that all my additions are in a separate template and means the difference between the original template and my own will be minimal making the upgrade process easier. In the past I used to spend ages comparing template versions to put that the changes I had made into the latest versions of the templates. So doing things this way means that will happen less often.
angedelamort
01-01-2010, 12:28 AM
Thanks. That's what I approximately did. consolegaming, I had the same problem as you with the merge with 3.x, so I'll do it your way since it's a really good idea for future updates.
But I was wondering if there was a system in place since it's common that you want to add your own styles and not really change the original one. It seems that you have to do it manually.
consolegaming
01-01-2010, 02:06 AM
Yeah they removed the Additional CSS function (which served this purpose on 3.x) for this version of VB which was a bit of a shame but this way works pretty well. Certainly not as user friendly though. Hopefully they'll try and rectify that in the future.
The other thing that should help updating templates is this template merger (or whatever it's called) thing they've introduced which to my understanding will compare your customized version of a template with the original/new versions and it'll try and merge the templates together.
So that should help things substantially though as I said in my previous post I'm still trying to keep the template modifications down to a minimum. i.e. the style thing from above as well as using custom templates for my header and footer (ad locations weren't suitable). Whereas previously my header code was in the 'header' template so having a 1 liner calling my custom template is a much neater solution lol.
ageurtse
01-23-2010, 12:34 PM
Hi there i have a aditonal css template but i don't know how to include it to the list so it will be loaded.
how did you do that.
Lynne
01-23-2010, 02:49 PM
The template additional.css gets loaded on everypage (except the ones that use the USERCP_SHELL since he forgot to add it there, but you can add it yourself).
ageurtse
01-23-2010, 02:55 PM
i have almost managed it, except one tiny thing see new thread in programming help.
BSMedia
01-23-2010, 05:56 PM
Hello,
I'm testing some functionality and since I'm not to used with the news "style" system I was wondering what is the right way to add custom CSS style:
<style>
.styleName div { border:ridge; }
</style>
so when I use it somewhere else, I can do
<div class="styleName">...</div>
Thanks
it would be .stylename {border: ridge;}
<div class="stylename"></div>
if you define it your way, than all dives inside of styleName will also inheirt the border. But if thats what you want it won't be a problem ;)
gibigbig
11-08-2010, 08:39 PM
in vb 4.0 you get a blank error when you edit the headerinclude template, why is this?
Lynne
11-08-2010, 10:41 PM
in vb 4.0 you get a blank error when you edit the headerinclude template, why is this?
No idea as I don't have this happen when I edit that template. What does this question have to do with this thread?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.