<?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>Webmonkey &#187; div</title>
    <atom:link href="http://www.webmonkey.com/tag/div/feed/" rel="self" type="application/rss+xml" />
    <link>http://www.webmonkey.com</link>
    <description>The Web Developer&#039;s Resource</description>
    <lastBuildDate>Mon, 06 May 2013 17:29:19 +0000</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <generator>http://wordpress.org/?v=3.4.2</generator>
    
    <item>
        <title>Position Text and Images With Div Tags</title>
        <link>http://www.webmonkey.com/2010/02/position-text-and-images-with-div-tags/</link>
        <comments>http://www.webmonkey.com/2010/02/position-text-and-images-with-div-tags/#comments</comments>
        <pubDate>Tue, 16 Feb 2010 01:45:47 +0000</pubDate>

                <dc:creator>Webmonkey Staff</dc:creator>

        <guid isPermaLink="false">http://stag.wired.com/primate/?p=269</guid>
        		<category><![CDATA[HTML]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wiki]]></category>
        <description><![CDATA[Are you sick of putting align in every tag just to get a page to lay out properly? And how do you feel about table hacks for positioning images? I thought so. Well, never fear &#8211; the &#60;div&#62; tag is here. Although it&#8217;s been around since HTML 3.0, &#60;div&#62; didn&#8217;t really catch on until CSS-based [...]]]></description>

            <content:encoded><![CDATA[<!-- wpautop disabled --><p>Are you sick of putting <tt>align</tt> in every tag just to get a page to lay out properly? And how do you feel about table hacks for positioning images? I thought so.



Well, never fear &#8211; the <tt>&lt;div&gt;</tt> tag is here.



</p><p>Although it&#8217;s been around since HTML 3.0, <tt>&lt;div&gt;</tt> didn&#8217;t really catch on until CSS-based layouts became the rage du jour. It won&#8217;t solve all your problems, but it works for formatting large blocks of text, images, and just about anything else that has an HTML tag around it.
</p><p><br />
<span id="more-269"></span>

</p><p>So let&#8217;s get started. Say you have some text, an image, and then some more text, and you want to center them on your page, like this:



</p>

<blockquote>

&#8216;<b>Hi, I&#8217;m Mattmarg.&#8217;</b>



<br clear="all">



<img src="http://www.wired.com/wired/webmonkey/stuff/monkey.gif" alt="monkey.gif">



<br clear="all">

<b>I reffed the big game between Bridgeville and Casterlin.</b>

</blockquote>



<p>Now, you might be tempted to do something like this:

</p>

<pre class="brush: js">&lt;h3 align="center"&gt;Hi, I'm Mattmarg.&lt;/h3&gt;



&lt;p align="center"&gt;&lt;img src="monkey.gif"&gt;&lt;/p&gt;



&lt;h4 align="center"&gt;I reffed the big game between Bridgeville and

&lt;a href="http:www.hits.org/casterlin/"&gt;Casterlin&lt;/a&gt;.&lt;/h4&gt;

</pre>



<p>But with a <tt>&lt;div&gt;</tt> tag, your code would look like this:



</p>

<pre class="brush: js">&lt;div align="center"&gt;



&lt;h3&gt;Hi, I'm Mattmarg.&lt;/h3&gt;



&lt;p&gt;&lt;img src="monkey.gif"&gt;&lt;/p&gt;



&lt;h4&gt;I reffed the big game between Bridgeville and

&lt;a href="http:www.hits.org/casterlin/"&gt;Casterlin&lt;/a&gt;.&lt;/h4&gt;



&lt;/div&gt;

</pre>



<p>Cool, eh? The <tt>&lt;div&gt;</tt> tag will also work with other tags, like tables, forms, and lists.



</p><p><b>Tips:</b> What if you want those two paragraphs aligned to the left side of your page, but you want the image aligned in the center? Well, you can overwrite <tt>&lt;div&gt;</tt> tags by simply adding an <tt>align</tt> attribute to the tag you want to be different. Once the tag closes, the layout characteristics defined by the <tt>&lt;div&gt;</tt> tag take effect again.<div id='linker_widget' class='contextly-widget'></div>]]></content:encoded>
            <wfw:commentRss>http://www.webmonkey.com/2010/02/position-text-and-images-with-div-tags/feed/</wfw:commentRss>
        <slash:comments>1</slash:comments>

        
    </item>
    </channel>
</rss>
