<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://mydrupalblog.lhmdesign.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>My Drupal Blog - Theming The Search Submit Button - A CSS Cross-Browser Compatible Solution - Comments</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution</link>
 <description>Comments for &quot;Theming The Search Submit Button - A CSS Cross-Browser Compatible Solution&quot;</description>
 <language>en</language>
<item>
 <title>HI i need your help i really</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-11562</link>
 <description>&lt;p&gt;HI i need your help i really want to create my own website/web page but i dont know how to go about doing it so can you please help me out&lt;/p&gt;
</description>
 <pubDate>Fri, 04 Jul 2008 14:17:31 -0700</pubDate>
 <dc:creator>Free Submission</dc:creator>
 <guid isPermaLink="false">comment 11562 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>css Cursor examples ,</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-11348</link>
 <description>&lt;p&gt;css Cursor examples , Properties , Attribute   - - &lt;a href=&quot;http://css-lessons.ucoz.com/cursor-css-examples.htm&quot; title=&quot;http://css-lessons.ucoz.com/cursor-css-examples.htm&quot;&gt;http://css-lessons.ucoz.com/cursor-css-examples.htm&lt;/a&gt;&lt;/p&gt;
</description>
 <pubDate>Fri, 20 Jun 2008 07:12:18 -0700</pubDate>
 <dc:creator>hazır kayan yazı</dc:creator>
 <guid isPermaLink="false">comment 11348 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Thanks a load mate, really</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-11340</link>
 <description>&lt;p&gt;Thanks a load mate, really helped my css-uneducated ass out! I should probably stop obsessing over little details, though; tis unhealthy.&lt;/p&gt;
</description>
 <pubDate>Thu, 19 Jun 2008 09:24:06 -0700</pubDate>
 <dc:creator>Eglen</dc:creator>
 <guid isPermaLink="false">comment 11340 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Worked like a charm! Thanks!</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-11007</link>
 <description>&lt;p&gt;Worked like a charm! Thanks!&lt;/p&gt;
</description>
 <pubDate>Wed, 04 Jun 2008 07:47:06 -0700</pubDate>
 <dc:creator>Kyle</dc:creator>
 <guid isPermaLink="false">comment 11007 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>If you cant add a div for IE</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-11006</link>
 <description>&lt;p&gt;If you cant add a div for IE and use conditional tags, just use the underscore hack for IE Only:&lt;/p&gt;
&lt;p&gt;    _font-size: 0;&lt;br /&gt;
    _color: #fff&lt;br /&gt;
    _text-align: right;&lt;br /&gt;
    _padding-right:2px;&lt;/p&gt;
&lt;p&gt;Mozilla, Opera and Safari will ignore any CSS dec&#039;s with an underscore before them! ;)&lt;/p&gt;
</description>
 <pubDate>Wed, 04 Jun 2008 02:09:11 -0700</pubDate>
 <dc:creator>Tom Taylor</dc:creator>
 <guid isPermaLink="false">comment 11006 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>This rollover image submit</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-10821</link>
 <description>&lt;p&gt;This rollover image submit button would probably serve &#039;most&#039; peoples needs..&lt;/p&gt;
&lt;p&gt;&amp;lt;input type=&amp;quot;image&amp;quot; src=&amp;quot;images/search.gif&amp;quot; onmouseover=&amp;quot;this.src=&#039;images/searchon.gif&#039;&amp;quot; onmouseout=&amp;quot;this.src=&#039;images/search.gif&#039;&amp;quot; alt=&amp;quot;Hello World&amp;quot; title=&amp;quot;Hello World&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;Simple :)&lt;/p&gt;
</description>
 <pubDate>Thu, 24 Apr 2008 02:17:01 -0700</pubDate>
 <dc:creator>Mike</dc:creator>
 <guid isPermaLink="false">comment 10821 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Nice trick - although, I</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-10792</link>
 <description>&lt;p&gt;Nice trick - although, I should point out: No need for the additional div - just add that CSS you&#039;d like for IE-only in between the comments (where you have the div).  This will overwrite your &quot;real&quot; css file, and avoids extra markup! (You just have to make sure that the commented CSS comes after the link to your stylesheet).&lt;/p&gt;
</description>
 <pubDate>Sun, 13 Apr 2008 21:25:12 -0700</pubDate>
 <dc:creator>Kyle</dc:creator>
 <guid isPermaLink="false">comment 10792 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Thanks a load mate,  really</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-10772</link>
 <description>&lt;p&gt;Thanks a load mate,  really helped my css-uneducated ass out! I should probably stop obsessing over little details, though; tis unhealthy.&lt;/p&gt;
</description>
 <pubDate>Thu, 03 Apr 2008 17:48:04 -0700</pubDate>
 <dc:creator>Secret Owl</dc:creator>
 <guid isPermaLink="false">comment 10772 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Laurence,
Thanks for the</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-6436</link>
 <description>&lt;p&gt;Laurence,&lt;/p&gt;
&lt;p&gt;Thanks for the tip. I have a few of questions about your tip and I&#039;m wondering if you could answer them:&lt;/p&gt;
&lt;p&gt;-- The IE width is 10px more than the regular (ie 34px vs 24px). Why 10px? Is it always 10px more than whatever works in FF? Basically, how did you figure out that difference? &lt;/p&gt;
&lt;p&gt;-- Can you get rid of the conditional IE DIV if you use conditional IE CSS?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;
Rene&lt;/p&gt;
</description>
 <pubDate>Thu, 01 Nov 2007 15:32:14 -0700</pubDate>
 <dc:creator>Rene Hache</dc:creator>
 <guid isPermaLink="false">comment 6436 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Fiasst, you probably found</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-5503</link>
 <description>&lt;p&gt;Fiasst, you probably found that bit of code &lt;a href=&quot;http://drupal.org/node/45295&quot;&gt;here&lt;/a&gt;, and I couldn&#039;t agree more it is very handy!&lt;/p&gt;
</description>
 <pubDate>Thu, 04 Oct 2007 03:09:26 -0700</pubDate>
 <dc:creator>Adam</dc:creator>
 <guid isPermaLink="false">comment 5503 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Ive used a custom search</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-5435</link>
 <description></description>
 <pubDate>Tue, 02 Oct 2007 09:22:22 -0700</pubDate>
 <dc:creator>Fiasst</dc:creator>
 <guid isPermaLink="false">comment 5435 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Clean CSS solutions are</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-3284</link>
 <description>&lt;p&gt;Clean CSS solutions are loads better than wacky template hacks that subvert the form api. Great bit of code! Thanks!&lt;/p&gt;
</description>
 <pubDate>Thu, 02 Aug 2007 15:52:01 -0700</pubDate>
 <dc:creator>ragaskar</dc:creator>
 <guid isPermaLink="false">comment 3284 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>I&#039;m not sure I&#039;d use the</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-112</link>
 <description>&lt;p&gt;I&#039;m not sure I&#039;d use the word fun ;-)&lt;/p&gt;
</description>
 <pubDate>Tue, 19 Jun 2007 08:00:47 -0700</pubDate>
 <dc:creator>Laurence</dc:creator>
 <guid isPermaLink="false">comment 112 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Nice trick, I mean</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comment-111</link>
 <description>&lt;p&gt;Nice trick, I mean hack.&lt;br /&gt;
It&#039;s always a fun to fight with IE&lt;/p&gt;
</description>
 <pubDate>Tue, 19 Jun 2007 07:03:28 -0700</pubDate>
 <dc:creator>themegarden.org</dc:creator>
 <guid isPermaLink="false">comment 111 at http://mydrupalblog.lhmdesign.com</guid>
</item>
<item>
 <title>Theming The Search Submit Button - A CSS Cross-Browser Compatible Solution</title>
 <link>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution</link>
 <description>&lt;p&gt;More sites these days are using a custom image like a magnifying glass, or the word &#039;GO&#039; in a circle, instead of the default search submit button.  Here&#039;s a way that you can do the same thing with the Drupal search function, and only have to use CSS - no PHP and no editing template files (well, almost). &lt;/p&gt;
&lt;p&gt;The image on the left shows the default search submit button, and the image on the right shows the new search submit button that we&#039;ll replace it with.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/files/blogimg/search_box_oldnew.png&quot; alt=&quot;The default search box and the new search box&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It&#039;s really just a simple three step process:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Step 1: Create your image&lt;/li&gt;
&lt;li&gt;Step 2: Add a conditional comment to your page.tpl.php file&lt;/li&gt;
&lt;li&gt;Step 3: Add your CSS&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Step 1: Create your image&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The image can be of whatever you like, and is probably best in .jpg format. &lt;/p&gt;
&lt;p&gt;Just make sure you save it into your theme&#039;s normal images folder. &lt;/p&gt;
&lt;p&gt;For instance, if I am going to use an image of a magnifying glass called &#039;mag_glass.jpg&#039; I would save it to &#039;/sites/all/themes/mydrupalblog/images/mag_glass.jpg&#039;&lt;/p&gt;
&lt;p&gt;&lt;!--break--&gt;&lt;br /&gt;
&lt;strong&gt;Step 2: Add a conditional comment to your page.tpl.php file&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A conditional comment is just a small bit of code which we add to the page.tpl.php file in order to allow us to specifically target Internet Explorer with different CSS rules.&lt;/p&gt;
&lt;p&gt;As you&#039;ll see in a second, this is necessary because Internet Explorer interprets our CSS differently, and we need to supply it with some extra rules to make it look right.&lt;/p&gt;
&lt;p&gt;In short, you just need to add the following code to your page.tpl.php file directly after the opening body tag&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;!--[if IE]&amp;gt;&amp;lt;div id=&amp;quot;IEroot&amp;quot;&amp;gt;&amp;lt;![endif]--&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;and then add the following directly before the closing body tag.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;!--[if IE]&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;![endif]--&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Basically, this creates a new div with an id of &#039;IEroot&#039; which wraps around everything inside of our body tags if a user is browsing with Internet Explorer, and ignores it if a user is using any other browser like Firefox.  This allows us to write CSS which targets the #IEroot, and know that it will only be used by IE - very handy.&lt;/p&gt;
&lt;p&gt;For those who are interested, a detailed explanation of this method can be found in&lt;br /&gt;
&lt;a href=&quot;http://www.positioniseverything.net/articles/cc-plus.html&quot; title=&quot;Targeting IE using conditional comments&quot;&gt;this article&lt;/a&gt; over at positioniseverything.net.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3: Add your CSS&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Finally, we add the necessary CSS to our style.css file.&lt;/p&gt;
&lt;p&gt;We&#039;ll start by adding the general rules which cover most browsers&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#search-block-form input.form-submit, #search-form input.form-submit {&lt;br /&gt;	height: 24px;&lt;br /&gt;	width: 24px;&lt;br /&gt;	cursor: pointer;&lt;br /&gt;	text-indent: -9999px;&lt;br /&gt;	border: none;&lt;br /&gt;	background: url(images/mag_glass.jpg) no-repeat left top;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The above code covers both the search block and the search form on the main page.  Just &lt;strong&gt;remember&lt;/strong&gt; to change the height and width accordingly for your own image.&lt;/p&gt;
&lt;p&gt;This now looks great in Firefox, but not so good in IE.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/files/blogimg/search_box_ffie.png&quot; alt=&quot;The search box in Firefox and the search box in IE&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The problem is that IE will not text-indent the text on the submit button. Also, IE now completely removes the search submit button from the Advanced search fieldset on the main page.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/files/blogimg/search_adv_ffie.png&quot; alt=&quot;The advanced search form in Firefox and IE&quot; /&gt;&lt;/p&gt;
&lt;p&gt;So, we need to find a sneaky way of making it look like the text has actually been removed from IE when it hasn&#039;t, and also sort out that missing search button.&lt;/p&gt;
&lt;p&gt;The following code will do the trick:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#IEroot .block-search input.form-submit, #IEroot #search-form input.form-submit {&lt;br /&gt;	width: 34px;&lt;br /&gt;	font-size: 0;&lt;br /&gt;	color: #fff;&lt;br /&gt;	text-align: right;&lt;br /&gt;}&lt;br /&gt;#IEroot #search-form .search-advanced input.form-submit {&lt;br /&gt;	width: 44px;&lt;br /&gt;	text-indent: 0;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Using the #IEroot selector, we first tell IE to make the text very small by declaring &#039;font-size: 0;&#039; (FIG 1).  However, IE still won&#039;t remove the text completely, so we then create an area to the right of the magnifying glass image into which we can put the text.  We do this by changing the width of the image and setting &#039;text-align: right;&#039; (FIG 2).  You will need to add 10px to the search block image width, and 20px to the advanced search form image width for this to work. Finally, we change the font color to match with our background, in this case white, and this completes the illusion (FIG 3).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/files/blogimg/search_box_iedone.png&quot; alt=&quot;Sorting out the search box in IE&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Lastly, adding &#039;text-indent: 0;&#039; to the #IEroot advanced search form gets IE to give us our submit button back :)&lt;/p&gt;
&lt;p&gt;So far, I have tested this in Firefox, IE7, and IE6.  It might seem like a slightly hackish solution, but it avoids any necessity to try and catch the search form by editing the template.php file and then have to setup extra .tpl.php files.  It also uses a relatively small amount of CSS, and is (hopefully) quite easy to understand.&lt;/p&gt;
</description>
 <comments>http://mydrupalblog.lhmdesign.com/theming-search-submit-button-css-cross-browser-compatible-solution#comments</comments>
 <category domain="http://mydrupalblog.lhmdesign.com/topic/css">CSS</category>
 <category domain="http://mydrupalblog.lhmdesign.com/taxonomy/term/1">Drupal</category>
 <category domain="http://mydrupalblog.lhmdesign.com/topic/drupal-theming">Drupal Theming</category>
 <category domain="http://mydrupalblog.lhmdesign.com/topic/search-box">Search Box</category>
 <pubDate>Mon, 18 Jun 2007 07:16:32 -0700</pubDate>
 <dc:creator>Laurence</dc:creator>
 <guid isPermaLink="false">24 at http://mydrupalblog.lhmdesign.com</guid>
</item>
</channel>
</rss>
