This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Why load default.css in the <body> of the page
#1

Steven:

I just upgraded from 2.1 to 2.5, and I've spent the last day and a half trying to customize look and feel in style sheets loaded in the <head>. It was very frustrating because most of the styling I tried was completely ignored. So I started digging around in the page source code, and I noticed that the first thing commentics does is load a google style sheet, and the commentics default.css. The code appears as follows:

<!-- Start of Commentics -->
<div class="cmtx_container">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="http://www.jldoty.com/comments/css/default.css" rel="stylesheet" type="text/css" />

Basically, you load style sheets in the body of the page, which overrides the overrides I was trying to override. I deleted the default.css so it couldn't load, and that fixed everything.

Why do you do that? Is something else going to blow up in my face now that I've deleted default.css?

Jim
Reply
#2

Hi Jim,

The stylesheet is loaded in the body for two main reasons:

1. It makes Commentics easier to integrate. There have been quite a few forum threads here about problems with there being no styling and it's always because the person either didn't add the stylesheet to their page's head tag or they added it but it didn't point to the right location. So letting Commentics do it solves this problem.

2. It allows you to easily override the stylesheet with your own styles so that your upgrades are safe. By adding a file called default.css into the /css/custom/ folder (so you have /css/custom/default.css), Commentics will automatically load it straight after the /css/default.css file. By doing this, you can override only the styles that you want, without them being wiped out the next time that you upgrade.

In the upgrade instructions for 2.4 -> 2.5, it does say in step 5 to remove the stylesheet line.

I appreciate it's a bit unorthodox to load it inside the body but for the reasons above I believe it's right.

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post

Forum Jump:


Users browsing this thread: 1 Guest(s)