<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comentarios en: Centrar un div horizontal y verticalmente con jQuery</title>
	<atom:link href="http://www.bufa.es/centrar-div-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bufa.es/centrar-div-jquery/</link>
	<description>Recursos web en español</description>
	<lastBuildDate>Sat, 04 Feb 2012 20:47:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Por: jose</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1389</link>
		<dc:creator>jose</dc:creator>
		<pubDate>Wed, 14 Dec 2011 16:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1389</guid>
		<description>y si en vez de tener un div con unas dimensiones establecidas, esas dimensiones son auto xq en dicho div se carga diferente contenido como podría solucionarlo?</description>
		<content:encoded><![CDATA[<p>y si en vez de tener un div con unas dimensiones establecidas, esas dimensiones son auto xq en dicho div se carga diferente contenido como podría solucionarlo?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Ari</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1386</link>
		<dc:creator>Ari</dc:creator>
		<pubDate>Wed, 07 Dec 2011 21:59:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1386</guid>
		<description>Corrección!

(function($){
	$.fn.centrar = function(cont){
		$(this).css(&#039;position&#039;,&#039;absolute&#039;);
		$(this).css({top: ($(cont).height() - $(this).outerHeight())/2});
		$(this).css({left: ($(cont).width() - $(this).outerWidth())/2});
	}
})(jQuery);

Se le de posición absoluta al elemento a centrar :P</description>
		<content:encoded><![CDATA[<p>Corrección!</p>
<p>(function($){<br />
	$.fn.centrar = function(cont){<br />
		$(this).css(&#8216;position&#8217;,'absolute&#8217;);<br />
		$(this).css({top: ($(cont).height() &#8211; $(this).outerHeight())/2});<br />
		$(this).css({left: ($(cont).width() &#8211; $(this).outerWidth())/2});<br />
	}<br />
})(jQuery);</p>
<p>Se le de posición absoluta al elemento a centrar <img src='http://www.bufa.es/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Ari</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1353</link>
		<dc:creator>Ari</dc:creator>
		<pubDate>Mon, 21 Nov 2011 17:39:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1353</guid>
		<description>Así es en Plugin Jquery - Ari Copyright :P

(function($){
	$.fn.center = function(cont){
		$(this).css({top: ($(cont).height() - $(this).outerHeight())/2});
		$(this).css({left: ($(cont).width() - $(this).outerWidth())/2});
	}
})(jQuery);

Se llamaría así:

$(&#039;#caja&#039;).centrar(&#039;body&#039;);

Donde dice #caja iría el elemento a centrar y en body (window o html) el contenedor, pudiendo ser el window-html-body u otro elemento (por ejemplo un icono centrado en un botón).</description>
		<content:encoded><![CDATA[<p>Así es en Plugin Jquery &#8211; Ari Copyright <img src='http://www.bufa.es/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>(function($){<br />
	$.fn.center = function(cont){<br />
		$(this).css({top: ($(cont).height() &#8211; $(this).outerHeight())/2});<br />
		$(this).css({left: ($(cont).width() &#8211; $(this).outerWidth())/2});<br />
	}<br />
})(jQuery);</p>
<p>Se llamaría así:</p>
<p>$(&#8216;#caja&#8217;).centrar(&#8216;body&#8217;);</p>
<p>Donde dice #caja iría el elemento a centrar y en body (window o html) el contenedor, pudiendo ser el window-html-body u otro elemento (por ejemplo un icono centrado en un botón).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: ddsign</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1186</link>
		<dc:creator>ddsign</dc:creator>
		<pubDate>Thu, 25 Aug 2011 08:12:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1186</guid>
		<description>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
  &lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
 $(window).resize(function(){
    
  // aquí le pasamos la clase o id de nuestro div a centrar (en este caso &quot;caja&quot;)
  $(&#039;.caja&#039;).css({
  position:&#039;absolute&#039;,
  left: ($(window).width() - $(&#039;.caja&#039;).outerWidth())/2,
  top: ($(window).height() - $(&#039;.caja&#039;).outerHeight())/2
  });
  
  });
// Ejecutamos la función
  $(window).resize();
  
  });
  &lt;/script&gt;
&#160;
&lt;/head&gt;
&lt;body &gt;

&lt;div class=&quot;caja&quot; style=&quot;border:1px solid red; &quot;&gt;
esta es la caja que quiero centrar


&lt;/div&gt;
&#160;
&lt;/body&gt;
  &lt;/html&gt;</description>
		<content:encoded><![CDATA[<p>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&#038;gt" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&#038;gt</a>;<br />
  &lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml&quot;&#038;gt" rel="nofollow">http://www.w3.org/1999/xhtml&quot;&#038;gt</a>;<br />
  &lt;head&gt;<br />
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;<br />
  &lt;title&gt;Untitled Document&lt;/title&gt;<br />
  &lt;script src=&quot;<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&#038;quot" rel="nofollow">http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&#038;quot</a>; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br />
  &lt;script&gt;<br />
  $(document).ready(function(){<br />
 $(window).resize(function(){</p>
<p>  // aquí le pasamos la clase o id de nuestro div a centrar (en este caso &quot;caja&quot;)<br />
  $(&#8216;.caja&#8217;).css({<br />
  position:&#8217;absolute&#8217;,<br />
  left: ($(window).width() &#8211; $(&#8216;.caja&#8217;).outerWidth())/2,<br />
  top: ($(window).height() &#8211; $(&#8216;.caja&#8217;).outerHeight())/2<br />
  });</p>
<p>  });<br />
// Ejecutamos la función<br />
  $(window).resize();</p>
<p>  });<br />
  &lt;/script&gt;<br />
&nbsp;<br />
&lt;/head&gt;<br />
&lt;body &gt;</p>
<p>&lt;div class=&quot;caja&quot; style=&quot;border:1px solid red; &quot;&gt;<br />
esta es la caja que quiero centrar</p>
<p>&lt;/div&gt;<br />
&nbsp;<br />
&lt;/body&gt;<br />
  &lt;/html&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: ddsign</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1185</link>
		<dc:creator>ddsign</dc:creator>
		<pubDate>Thu, 25 Aug 2011 08:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1185</guid>
		<description>Satoru, tienes que llamar a la librería jquery primero, te paso este código:





Untitled Document


	$(document).ready(function(){

     $(window).resize(function(){
 
          // aquí le pasamos la clase o id de nuestro div a centrar (en este caso &quot;caja&quot;)
          $(&#039;.caja&#039;).css({
               position:&#039;absolute&#039;,
               left: ($(window).width() - $(&#039;.caja&#039;).outerWidth())/2,
               top: ($(window).height() - $(&#039;.caja&#039;).outerHeight())/2
          });
       
    });

// Ejecutamos la función
$(window).resize();
 
});










esta es la caja que quiero centrar







</description>
		<content:encoded><![CDATA[<p>Satoru, tienes que llamar a la librería jquery primero, te paso este código:</p>
<p>Untitled Document</p>
<p>	$(document).ready(function(){</p>
<p>     $(window).resize(function(){</p>
<p>          // aquí le pasamos la clase o id de nuestro div a centrar (en este caso &#8220;caja&#8221;)<br />
          $(&#8216;.caja&#8217;).css({<br />
               position:&#8217;absolute&#8217;,<br />
               left: ($(window).width() &#8211; $(&#8216;.caja&#8217;).outerWidth())/2,<br />
               top: ($(window).height() &#8211; $(&#8216;.caja&#8217;).outerHeight())/2<br />
          });</p>
<p>    });</p>
<p>// Ejecutamos la función<br />
$(window).resize();</p>
<p>});</p>
<p>esta es la caja que quiero centrar</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: satoru</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1173</link>
		<dc:creator>satoru</dc:creator>
		<pubDate>Tue, 16 Aug 2011 02:59:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1173</guid>
		<description>hola podrias subir o enviarme un ejemplo mas completo por que me tira este error
$ is not definet
tendria que poner un  encabezado de jquery para que lo acepte?</description>
		<content:encoded><![CDATA[<p>hola podrias subir o enviarme un ejemplo mas completo por que me tira este error<br />
$ is not definet<br />
tendria que poner un  encabezado de jquery para que lo acepte?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Joel</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-1135</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Wed, 29 Jun 2011 18:10:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-1135</guid>
		<description>excelente el ejemplo, probado y funcionando, gracias</description>
		<content:encoded><![CDATA[<p>excelente el ejemplo, probado y funcionando, gracias</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Ms</title>
		<link>http://www.bufa.es/centrar-div-jquery/comment-page-1/#comment-449</link>
		<dc:creator>Ms</dc:creator>
		<pubDate>Sat, 11 Sep 2010 17:38:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.bufa.es/?p=295#comment-449</guid>
		<description>esta misma configuracion se puede establecer para plugins?
Como se puede crear una pagina con diferentes programaciones y ponerlas en el lugar adecuado de la pagiana.

Gracias</description>
		<content:encoded><![CDATA[<p>esta misma configuracion se puede establecer para plugins?<br />
Como se puede crear una pagina con diferentes programaciones y ponerlas en el lugar adecuado de la pagiana.</p>
<p>Gracias</p>
]]></content:encoded>
	</item>
</channel>
</rss>

