<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AEXT.NET MAGAZINE &#187; text-indent</title>
	<atom:link href="http://aext.net/tag/text-indent/feed/" rel="self" type="application/rss+xml" />
	<link>http://aext.net</link>
	<description>How to Create a Website</description>
	<lastBuildDate>Wed, 30 May 2012 05:03:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CSS text-indent: An Excellent Trick To Style Your HTML Form</title>
		<link>http://aext.net/2010/02/css-text-indent-style-your-html-form/</link>
		<comments>http://aext.net/2010/02/css-text-indent-style-your-html-form/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 05:57:12 +0000</pubDate>
		<dc:creator>Lief</dc:creator>
				<category><![CDATA[CSS & HTML]]></category>
		<category><![CDATA[CSS Trick]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[text-indent]]></category>

		<guid isPermaLink="false">http://aext.net/?p=3127</guid>
		<description><![CDATA[<p><a href="http://aext.net/theme/platinoom" title="Platinoom - Premium WordPress Themes"><img src="http://aext.net/wp-content/uploads/2011/04/platinoom_wordpress_theme.png" alt="ThemeKiss" /></a></p><p style="float: right;"><a href="http://api.tweetmeme.com/share?url=http://aext.net/2010/02/css-text-indent-style-your-html-form/&service=su.pr&service_api=b57727e991c454bd2b2c62ff71462c79"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://aext.net/2010/02/css-text-indent-style-your-html-form/" height="61" width="51" /></a></p>You properly know exactly what the property text-indent does in our css style. It's just a common property of css that everybody using everyday to hide the text in link block. Sure, text-indent is doing it well. However, it does not only just hide the text. It does more. <a href="http://aext.net/2010/02/css-text-indent-style-your-html-form/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://aext.net/theme/platinoom" title="Platinoom - Premium WordPress Themes"><img src="http://aext.net/wp-content/uploads/2011/04/platinoom_wordpress_theme.png" alt="ThemeKiss" /></a></p><p style="float: right;"><a href="http://api.tweetmeme.com/share?url=http://aext.net/2010/02/css-text-indent-style-your-html-form/&service=su.pr&service_api=b57727e991c454bd2b2c62ff71462c79"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://aext.net/2010/02/css-text-indent-style-your-html-form/" height="61" width="51" /></a></p><p>You probably know what the text-indent property does in CSS. It&#8217;s a common CSS property allowing webmasters to indent paragraphs and hide text for image-based links. Text-indent does this great; however, it doesn&#8217;t just hide and indent text. It does more.</p>
<p><span id="more-3127"></span></p>
<h3>What&#8217;s text-indent?</h3>
<hr />
<p>Text-indent specifies the horizontal indent from the left side of the parent block element for the first line in the block. The indent is only applied at the beginning of the block but not after any intervening line-breaking elements. Keep in mind that this property allows negative values, and if used this way, the first line will be indented to the left.</p>
<p>The text-indent property is supported in all major browsers. However, Internet Explorer fails to support the inherit value for the text-indent (Yes, even IE8).</p>
<h3>Hiding text using text-indent</h3>
<hr />
<p>Let&#8217;s say you have a logo and you want to display it in a link, so people can click on it. Only including the image of the logo has some drawbacks as far as SEO is concerned. Here&#8217;s a solution to handle this:</p>
<pre class="html">&lt;style type="text/css"&gt; 

h1 a {
    text-decoration: none;
    position: absolute; /* Depending on your placement */
    width: 260px;
    height: 100px;
    bottom: 0px; /* Depending on your placement */
    background: url(images/aext-logo.png) no-repeat left top;
    text-indent: -99999px;
}

&lt;/style&gt;

&lt;h1&gt;&lt;a href="http://aext.net"&gt;AEXT.NET&lt;/a&gt;&lt;/h1&gt;</pre>
<p>With this, search engines will still recognize the text, but users will only see the logo because the text is indented to the left (99999px). See:</p>
<p>[inline]</p>
<p>[/inline]</p>
<div id="demo1">
<h1><a href="http://aext.net">AEXT.NET</a></h1>
</div>
<p>This is not a new CSS technique and probably one of the most widely used techniques today. The way it works is very simple: the text in any block (not just links; such block-level elements, table cells, and inline blocks) will be pushed so far to the left (off screen) that its background image will remain the only thing the user see. The value of the text-indent property tells the browser at what point, relatively, the text should start.</p>
<h3>An awesome trick using text-indent &amp; forms</h3>
<hr />
<p>People mostly use text-indent to hide text like our example above. They often use the negative value for text-indent but forget to make use of its original intent: inset indentation. Here I&#8217;ll show you how to make a beautiful text field using text-indent.</p>
<p>Let&#8217;s use a simple search form as an example:</p>
<pre class="html">&lt;form action="http://aext.net" id="search" method="get"&gt;
    &lt;fieldset&gt;
        &lt;input type="text" id="searchtxt" name="s" value=""&gt;
    &lt;/fieldset&gt;
&lt;/form&gt;</pre>
<p>Before the CSS, your text field looks something like this:</p>
<p>[inline]</p>
<div id="demo2">
<form id="search" action="http://aext.net" method="get">
<fieldset><label for="searchtxt">Enter your keyword: </label><br />
<input id="searchtxt" type="text" name="s" value="" /></fieldset>
</form>
</div>
<p>[/inline]</p>
<p>First, let&#8217;s style it up and make it look a bit better with this CSS:</p>
<pre class="html">&lt;style type="text/css"&gt;

fieldset {
    border: none;
}

label
{
    font-family: Helvetica,arial,sans-serif;
    font-size: 15px;
    font-weight: bold;
    color: #9F0000;
}

input[type="text"]
{
    border:1px solid #CCCCCC;
    color:#516064;
    font-family: Helvetica,arial,sans-serif;
    font-size:16px;
    margin-bottom:20px;
    padding:8px;
    width:400px;
}
&lt;/style&gt;

&lt;form action="http://aext.net" id="search" method="get"&gt;
    &lt;fieldset&gt;
        &lt;label for="searchtxt"&gt;Search: &lt;/label&gt;
        &lt;input type="text" id="searchtxt" name="s" value=""/&gt;
    &lt;/fieldset&gt;
&lt;/form&gt;</pre>
<p>The result?</p>
<p>[inline]</p>
<div id="demo3">
<form id="search2" action="http://aext.net" method="get">
<fieldset><label for="searchtxt2">Search: </label><br />
<input id="searchtxt2" type="text" name="s" value="" /></fieldset>
</form>
</div>
<p>[/inline]</p>
<p>The label is now above the input field but it&#8217;d look amazing if we wrapped it with the input element and made the entered text follow after the label. We&#8217;d usually do it with the padding value, but today we&#8217;ll do it with text-indent.</p>
<p>Alright, now for the trick! Here it is:</p>
<pre class="html">&lt;style type="text/css"&gt;

fieldset {
    border: none;

    /* trick */
    position: relative;
}

label
{
    font-family: Helvetica,arial,sans-serif;
    font-size: 15px;
    font-weight: bold;
    color: #9F0000;

    /* trick */
    left:10px;
    top:9px;
    position:absolute;
}

input[type="text"]
{
    border:1px solid #CCCCCC;
    display: block;
    color:#516064;
    font-family: Helvetica,arial,sans-serif;
    font-size:16px;
    margin-bottom:20px;
    padding:8px;
    width:400px;

    /* trick */
    text-indent:75px;
}
&lt;/style&gt;

&lt;form action="http://aext.net" id="search" method="get"&gt;
    &lt;fieldset&gt;
        &lt;label for="searchtxt"&gt;Search: &lt;/label&gt;
        &lt;!-- Remember to set mexlength for the input --&gt;
        &lt;input type="text" id="searchtxt" name="s" value=""
                                          maxlength="35" /&gt;
    &lt;/fieldset&gt;
&lt;/form&gt;</pre>
<p>What you get after the trick:</p>
<p>[inline]</p>
<div id="demo4">
<form id="search4" action="http://aext.net" method="get">
<fieldset><label for="searchtxt4">Search: </label><br />
<input id="searchtxt4" type="text" name="s" value="" maxlength="35" /></fieldset>
</form>
</div>
<p>[/inline]</p>
<p>Although it looks great &amp; works perfectly, you <em>need</em> to set the maxlength value for the input element to avoid text moving to left and getting in the way of the label. Here&#8217;s a sample of how you could use this technique in the &#8220;real world&#8221;:</p>
<p>[inline]</p>
<div id="demo5">
<h4>Choose an username for your portfolio:</h4>
<form id="search5" action="http://aext.net" method="get">
<fieldset><label for="searchtxt5">http://whofreelance.com/</label><br />
<input id="searchtxt5" type="text" name="s" value="lamnguyen" maxlength="20" /></fieldset>
</form>
</div>
<p>[/inline]</p>
<p><strong>Updated:</strong> <del datetime="2010-02-04T10:54:33+00:00">It will display incorrectly in IE6 &amp; IE7 because the css in this tutorial conflicts with the css in this WordPress theme. It works well in its own page.</del> There is a bug in IE with the input element by using text-indent that I forgot. That&#8217;s &#8220;Peekaboo Bug&#8221;. It will make the text inside the text input display weird by floating to the left, but when refreshed, the bug is gone. Alright, edit something in your css text field:</p>
<pre class="html">&lt;style type="text/css"&gt;

input[type="text"]
{   
    display:block;
    line-height: 100%;
}

&lt;/style&gt;</pre>
<p>So, what do you think? If you find any issues in this tutorial, please drop a line in comment section! Hope you like it and be sure to spread the love by sharing this article with the buttons below. Thanks!</p>
<div class="txtad-cont"></div>
]]></content:encoded>
			<wfw:commentRss>http://aext.net/2010/02/css-text-indent-style-your-html-form/feed/</wfw:commentRss>
		<slash:comments>76</slash:comments>
		</item>
	</channel>
</rss>

