When I add new styles to the template.css, Joomla doesn't save them for a long time it keeps resetting the code. although the html code keeps the new lines that I add. Why is this happening!!
3 Answers
Probably every time you update Joomla, you the template.css file gets updated and with a news version and you lose the changes you made.
The correct way to customize your Joomla website is using template overrides. This way you do not modify the Joomla core files, and your changes will never get overriden.
This can be for one of this possible reasons:
Your template uses some framework, like T3 or Helix, and you have enabled a feature that allows you to compile the code every time the page is reloaded.
Solution 1: Check if you have this option enabled in Templates > Your Template
Solution 2: Some template frameworks allows you to add another css file called custom.css or similar, in this way you can add your code that replaces the general css.
You are trying to replace the css code of an extension as a module, normally these files are added below the related template, this works similar to:
your_site/.../general.css
your_site/.../template.css
your_site/.../preset.css
your_site/.../custom.css
your_site/.../module1.css (in the cascade, this file override all the previous css code)Solution 1: Also, some templates allows you to add your custom code in Templates > Your Template, check if you have this feature.
Solution 2: Add your custom css in your custom.css file and check the specificity, if you only have a few css rules you can use !important.
Solution 3: Change the code directly in the extension.
Also you can add your custom css vía extensions, but try with any of the above solutions: http://extensions.joomla.org/extensions/extension/style-a-design/templating/cssconfig http://extensions.joomla.org/extensions/extension/style-a-design/templating/css2switch-basic
You can use a tool like Firebug for inspect the source code of your page in your browser, this will help you to save a lot of time.
You didn't specified if this is happening during saving or right after it, or if your custom.css rules remain untouched until you perform an update to Joomla or your template.
If you fall into the first case, I don't have an answer at hands right now. But for the the second case what you see happening is absolutely normal.
Golden Rule: Never, ever modify core files (if you want to maintain your customizations). That's because each update will replace core files, resulting in loss of your modified ones.
Joomla and most of the commercial templates provide the ability to create overrides. This is how you have to approach this, in order to add your own custom css.
This question for css overrides will give you a good ground for what you need to do: How do I override the CSS styles in my template?
There are also extensions that allow this, if you can't find other ways.