<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Joomla! - Open Source Content Management" -->
<feed xmlns="http://www.w3.org/2005/Atom"  xml:lang="en-gb">
	<title type="text">Joomla! Tutorials</title>
	<subtitle type="text"></subtitle>
	<link rel="alternate" type="text/html" href="https://www.youjoomla.com"/>
	<id>https://www.youjoomla.com/youjoomla-blog/joomla-tutorials/feed/rss/page-2</id>
	<updated>2023-10-01T18:20:02+00:00</updated>
	<generator uri="http://joomla.org" version="2.5">Joomla! - Open Source Content Management</generator>
	<link rel="self" type="application/atom+xml" href="https://www.youjoomla.com/youjoomla-blog/joomla-tutorials/feed/rss/page-2?type=atom"/>
	<entry>
		<title>How to use  module CSS override?</title>
		<link rel="alternate" type="text/html" href="https://www.youjoomla.com/joomla-tutorials/how-to-use-module-css-override.html"/>
		<published>2007-01-18T00:00:00+00:00</published>
		<updated>2007-01-18T00:00:00+00:00</updated>
		<id>https://www.youjoomla.com/joomla-tutorials/how-to-use-module-css-override.html</id>
		<author>
			<name>Dragan Todorovic</name>
			<email>nocniagenti@gmail.com</email>
		</author>
		<summary type="html">&lt;div class=&quot;K2FeedImage&quot;&gt;&lt;img src=&quot;https://www.youjoomla.com/media/k2/items/cache/e529a8dc22bd84a37f6f8ae6b8ce40d3_S.jpg&quot; alt=&quot;How to use  module CSS override?&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;K2FeedIntroText&quot;&gt;&lt;p&gt;Many of you have already heard about it but not everyone knows what it is and how to use it. In this short &quot;how to&quot; tutorial we will explain what CSS override is and how to use it&lt;/div&gt;&lt;div class=&quot;K2FeedFullText&quot;&gt; on your websites. First rule of CSS is the last defined property in CSS file order is the one that is going to be used in layout. Basically&amp;nbsp; if you have same property defined in your stylesheet twice , the one that is last will be the one that is used.&lt;br/&gt;&lt;br/&gt;
Example:&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
p.text{
 padding:0;
}
 /* this one will be used in your layout */
 p.text{
 padding:5px;
 }
[/yjsgpre]
&lt;p&gt;So how do we use this in our Joomla templates?&lt;br/&gt;&lt;br/&gt;
Your Joomla template CSS files are loaded after the main head Joomla tags. Main head Joomla tags&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
&lt;jdoc:include type=&quot;head&quot; /&gt;
[/yjsgpre]
&lt;p&gt;load any JS and CSS files before your template CSS. So if we for example use YJ NS 8 module , the module CSS will be loaded before the template css files and this way we will get the advantage of using CSS override for this or any module in our template CSS and adapt it to fit our website.&lt;br/&gt;&lt;br/&gt;
Here is the default &lt;a target=&quot;_blank&quot; href=&quot;http://extensions.youjoomla.info/yj-news-slider-8.html&quot; title=&quot;YJ NS 8 Demo&quot;&gt;YJ NS 8&lt;/a&gt; module look. And &lt;a target=&quot;_blank&quot; href=&quot;http://joomlatemplates.youjoomla.info/yournews/&quot; title=&quot;YJ NS8 CSS Override&quot;&gt;here &lt;/a&gt;is the same module (called YouNews Entertainment on our demo ) but with CSS overrides.&lt;br /&gt; You would never say that this is a same module right? What did we do ? Well here is default &lt;a target=&quot;_blank&quot; href=&quot;http://extensions.youjoomla.info/modules/mod_yj_ns8/css/stylesheet.css&quot;&gt;module css&lt;/a&gt; file which is loading before our layout.css . We took few CSS properties from that stylesheet and moved it to our template &lt;a target=&quot;_blank&quot; href=&quot;http://joomlatemplates.youjoomla.info/yournews/templates/yournews/css/layout.css&quot; title=&quot;Edited CSS &quot;&gt;layout.css&lt;/a&gt; file. You can find the lines starting with&amp;nbsp;&amp;nbsp;&lt;em&gt;/*NEWS SLIDER 8.0*/&amp;nbsp;&lt;br /&gt; &lt;/em&gt;&lt;br /&gt; This technique can be used with any Joomla module and this way you do not have to edit default module CSS file to accomplish desired layout.&lt;/p&gt;&lt;/div&gt;</summary>
		<content type="html">&lt;div class=&quot;K2FeedImage&quot;&gt;&lt;img src=&quot;https://www.youjoomla.com/media/k2/items/cache/e529a8dc22bd84a37f6f8ae6b8ce40d3_S.jpg&quot; alt=&quot;How to use  module CSS override?&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;K2FeedIntroText&quot;&gt;&lt;p&gt;Many of you have already heard about it but not everyone knows what it is and how to use it. In this short &quot;how to&quot; tutorial we will explain what CSS override is and how to use it&lt;/div&gt;&lt;div class=&quot;K2FeedFullText&quot;&gt; on your websites. First rule of CSS is the last defined property in CSS file order is the one that is going to be used in layout. Basically&amp;nbsp; if you have same property defined in your stylesheet twice , the one that is last will be the one that is used.&lt;br/&gt;&lt;br/&gt;
Example:&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
p.text{
 padding:0;
}
 /* this one will be used in your layout */
 p.text{
 padding:5px;
 }
[/yjsgpre]
&lt;p&gt;So how do we use this in our Joomla templates?&lt;br/&gt;&lt;br/&gt;
Your Joomla template CSS files are loaded after the main head Joomla tags. Main head Joomla tags&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
&lt;jdoc:include type=&quot;head&quot; /&gt;
[/yjsgpre]
&lt;p&gt;load any JS and CSS files before your template CSS. So if we for example use YJ NS 8 module , the module CSS will be loaded before the template css files and this way we will get the advantage of using CSS override for this or any module in our template CSS and adapt it to fit our website.&lt;br/&gt;&lt;br/&gt;
Here is the default &lt;a target=&quot;_blank&quot; href=&quot;http://extensions.youjoomla.info/yj-news-slider-8.html&quot; title=&quot;YJ NS 8 Demo&quot;&gt;YJ NS 8&lt;/a&gt; module look. And &lt;a target=&quot;_blank&quot; href=&quot;http://joomlatemplates.youjoomla.info/yournews/&quot; title=&quot;YJ NS8 CSS Override&quot;&gt;here &lt;/a&gt;is the same module (called YouNews Entertainment on our demo ) but with CSS overrides.&lt;br /&gt; You would never say that this is a same module right? What did we do ? Well here is default &lt;a target=&quot;_blank&quot; href=&quot;http://extensions.youjoomla.info/modules/mod_yj_ns8/css/stylesheet.css&quot;&gt;module css&lt;/a&gt; file which is loading before our layout.css . We took few CSS properties from that stylesheet and moved it to our template &lt;a target=&quot;_blank&quot; href=&quot;http://joomlatemplates.youjoomla.info/yournews/templates/yournews/css/layout.css&quot; title=&quot;Edited CSS &quot;&gt;layout.css&lt;/a&gt; file. You can find the lines starting with&amp;nbsp;&amp;nbsp;&lt;em&gt;/*NEWS SLIDER 8.0*/&amp;nbsp;&lt;br /&gt; &lt;/em&gt;&lt;br /&gt; This technique can be used with any Joomla module and this way you do not have to edit default module CSS file to accomplish desired layout.&lt;/p&gt;&lt;/div&gt;</content>
		<category term="Joomla! Tutorials" />
	</entry>
	<entry>
		<title>PHP conditional comments</title>
		<link rel="alternate" type="text/html" href="https://www.youjoomla.com/joomla-tutorials/php-conditional-comments.html"/>
		<published>2007-01-18T00:00:00+00:00</published>
		<updated>2007-01-18T00:00:00+00:00</updated>
		<id>https://www.youjoomla.com/joomla-tutorials/php-conditional-comments.html</id>
		<author>
			<name>Dragan Todorovic</name>
			<email>nocniagenti@gmail.com</email>
		</author>
		<summary type="html">&lt;div class=&quot;K2FeedImage&quot;&gt;&lt;img src=&quot;https://www.youjoomla.com/media/k2/items/cache/d6e0c71ca3722c71ddd73a242718257f_S.jpg&quot; alt=&quot;PHP conditional comments&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;K2FeedIntroText&quot;&gt;&lt;p&gt;As web developers we often have to use different CSS techniques for different browser types. Now days every browser has it's own hack but imagine if you have to use custom CSS&lt;/div&gt;&lt;div class=&quot;K2FeedFullText&quot;&gt; hack for each browser there is and load html conditional comments for each! That would be to much code in head tag . To keep it neat and load conditional comment only when specific browser is used here is a small PHP snippet that can help keep your code organized.&lt;/p&gt;
&lt;p&gt; First we place the browser detection snippet in our index.php file :&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
$who = strtolower($_SERVER['HTTP_USER_AGENT']);
[/yjsgpre]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Than we load the conditional comment to be used only if visitor is using IE6 browser :&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
if(preg_match(&quot;/msie 6.0/&quot;, $who)){ echo'
&lt;style type=&quot;text/css&quot;&gt;
#mydiv{
padding:5px;
}
&lt;/style&gt;';
}
[/yjsgpre]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To load different style for other browsers simply change the browser name in first line of code&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
if(preg_match(&quot;/chrome/&quot;, $who)) {
[/yjsgpre]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;strong&gt;Here is the list of other browsers you can use:&lt;/strong&gt;&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;mozila &lt;strong&gt;// Firefox&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;msie 7.0 &lt;strong&gt;// Internet Explorer 7.0&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;msie 8.0 &lt;strong&gt;// Internet Explorer 8.0&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;opera &lt;strong&gt;// Opera&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;chrome &lt;strong&gt;// Chrome&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;safari &lt;strong&gt;// Safari&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary>
		<content type="html">&lt;div class=&quot;K2FeedImage&quot;&gt;&lt;img src=&quot;https://www.youjoomla.com/media/k2/items/cache/d6e0c71ca3722c71ddd73a242718257f_S.jpg&quot; alt=&quot;PHP conditional comments&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;K2FeedIntroText&quot;&gt;&lt;p&gt;As web developers we often have to use different CSS techniques for different browser types. Now days every browser has it's own hack but imagine if you have to use custom CSS&lt;/div&gt;&lt;div class=&quot;K2FeedFullText&quot;&gt; hack for each browser there is and load html conditional comments for each! That would be to much code in head tag . To keep it neat and load conditional comment only when specific browser is used here is a small PHP snippet that can help keep your code organized.&lt;/p&gt;
&lt;p&gt; First we place the browser detection snippet in our index.php file :&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
$who = strtolower($_SERVER['HTTP_USER_AGENT']);
[/yjsgpre]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Than we load the conditional comment to be used only if visitor is using IE6 browser :&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
if(preg_match(&quot;/msie 6.0/&quot;, $who)){ echo'
&lt;style type=&quot;text/css&quot;&gt;
#mydiv{
padding:5px;
}
&lt;/style&gt;';
}
[/yjsgpre]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To load different style for other browsers simply change the browser name in first line of code&lt;/p&gt;
[yjsgpre pretty=&quot;1&quot; scroll=&quot;0&quot;]
if(preg_match(&quot;/chrome/&quot;, $who)) {
[/yjsgpre]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;strong&gt;Here is the list of other browsers you can use:&lt;/strong&gt;&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;mozila &lt;strong&gt;// Firefox&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;msie 7.0 &lt;strong&gt;// Internet Explorer 7.0&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;msie 8.0 &lt;strong&gt;// Internet Explorer 8.0&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;opera &lt;strong&gt;// Opera&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;chrome &lt;strong&gt;// Chrome&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;safari &lt;strong&gt;// Safari&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</content>
		<category term="Joomla! Tutorials" />
	</entry>
</feed>
