<?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>Fatih Hayrioğlu&#039;nun not defteri &#187; css-sprites</title>
	<atom:link href="http://www.fatihhayrioglu.com/tag/css-sprites/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fatihhayrioglu.com</link>
	<description>{ CSS, HTML ve Javascript }</description>
	<lastBuildDate>Thu, 09 Feb 2012 08:44:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=2012</generator>
		<item>
		<title>Basit Resimli Menü Yapmak</title>
		<link>http://www.fatihhayrioglu.com/basit-resimli-menu-yapmak/</link>
		<comments>http://www.fatihhayrioglu.com/basit-resimli-menu-yapmak/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 16:45:15 +0000</pubDate>
		<dc:creator>fatih.hayrioglu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[ardalan-kaydırmaca]]></category>
		<category><![CDATA[ardalan-özellikleri]]></category>
		<category><![CDATA[css-sprites]]></category>
		<category><![CDATA[menü-yapmak]]></category>
		<category><![CDATA[resimli-menü]]></category>

		<guid isPermaLink="false">http://www.fatihhayrioglu.com/?p=992</guid>
		<description><![CDATA[Daha önce resimli menü yapımını anlatmıştım. http://www.fatihhayrioglu.com/css-ile-menu-olusturmak-v-resimli-menuler/ ancak burada şöyle bir sorun ile karşılaştık; Bu makalede anlattığımız yöntem ile genel bir metot anlatarak tüm resimli menüler için şablon niteliğinde bir kod ürettik, yani tüm menüler bu kod ile üretilebilir(yatay, dikey, iki satır vb.) tabi bu kodumuzu biraz daha fazlalaştırdı ve karıştırdı. Ancak bir çok sefer [...]]]></description>
			<content:encoded><![CDATA[<p>Daha önce resimli menü yapımını anlatmıştım. <a title="http://www.fatihhayrioglu.com/css-ile-menu-olusturmak-v-resimli-menuler/" href="http://www.fatihhayrioglu.com/css-ile-menu-olusturmak-v-resimli-menuler/" >http://www.fatihhayrioglu.com/css-ile-menu-olusturmak-v-resimli-menuler/</a> ancak burada şöyle bir sorun ile karşılaştık; Bu makalede anlattığımız  yöntem ile genel bir metot anlatarak tüm resimli menüler için şablon  niteliğinde bir kod ürettik, yani tüm menüler bu kod ile  üretilebilir(yatay, dikey, iki satır vb.) tabi bu kodumuzu biraz daha  fazlalaştırdı ve karıştırdı. Ancak bir çok sefer biz sadece yatay ve  tek sıralı bir resimli menü yapıyoruz bu kadar koda ihtiyacımız yok.  İlgili makalenin yorumlarında da gördüğümüz gibi bir çok insan konuyu  anlamakta güçlük çekiyor bende bu nedenle sadece yatay menülere örnek  kısa bir kod ve örnek yaparak konuya açıklık getirmek istedim.</p>
<p>Daha  önceki makalemdede belirttiğim gibi bu menü ardalan kaydırma yöntemi  ile yapılmış bir menüdür. CSS&#8217;in bize kazandırdığı en büyük  avantajlardan biridir ardalan konumunu istediğimiz gibi ayarlamak. </p>
<p>Bu  metot ile tek resim kullandığımız için optimizasyon içinde bize büyük  avantaj sağlar. 5 elemanlı bir resimli menüde her bir eleman için tek  tek resim oluşturduğumuzda sayfa nette açılırken her bir resim için  istek yapılacaktır, buda sayfanın yavaş açılmasına neden olacaktır. Bu  metotta ise tek resim yüklenecek ve bu bize performans kazandıracaktır. </p>
<p>Çok basit bir xhtml kodu var. Birçok menü örneğinde olduğu gibi ul kodu;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul class=&quot;menu&quot;&gt;
    &lt;li id=&quot;mAnasayfa&quot;&gt;&lt;a href=&quot;#&quot;&gt;Ana Sayfa&lt;/a&gt;&lt;/li&gt;
    &lt;li id=&quot;mUrunler&quot;&gt;&lt;a href=&quot;#&quot;&gt;Ürünler&lt;/a&gt;&lt;/li&gt;
    &lt;li id=&quot;mHizmetler&quot;&gt;&lt;a href=&quot;#&quot;&gt;Hizmetler&lt;/a&gt;&lt;/li&gt;
    &lt;li id=&quot;mBizeUlasin&quot;&gt;&lt;a href=&quot;#&quot;&gt;Bize Ulaşın&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Menümüzün  resimlerini tek bir resim dosyası olarak hazırlayacağız. Biz burada  normal ve fare imleci üzerine geldiğindeki halini(:hover) koyduk ama  bunlara seçili ve tıklama durumlarınıda eklenebilir. </p>
<p><img src="/images/basit_resimli_menu.jpg" width="480" height="80" /></p>
<p>Şimdi CSS kodlarımızı yazalım.</p>
<p>ul için genel sıfırlama kodlarımızı yazalım</p>
<pre class="brush: css; title: ; notranslate">
ul.menu{
    margin:0;
    padding:0;
    list-style:none;
    width:480px;
    height:40px;
}
</pre>
<p>Sırasız listelerin her nesnesini(li) yan yana dizmek için float:left tanımını yapmalıyız.</p>
<pre class="brush: css; title: ; notranslate">
ul.menu li{
	float:left;
}
</pre>
<p>Linkler için genel tanımlarımızı yapalım</p>
<pre class="brush: css; title: ; notranslate">
ul li a{
    display:block;
    width:120px;
    height:40px;
    text-indent:-9999px;
    outline:none;
    text-decoration:none;
    background:url(images/basit_resimli_menu.jpg) 0 0 no-repeat;
}
</pre>
<p>Her bir menü nesnesinin yukarıdaki resimdeki konumunu belirlemeye geldi sıra. </p>
<pre class="brush: css; title: ; notranslate">
li#mAnasayfa a{background-position:0 0;}
li#mUrunler a{background-position:-120px 0;}
li#mHizmetler a{background-position:-240px 0;}
li#mBizeUlasin a{background-position:-360px 0;}
</pre>
<p>Basit  bir şekilde resimli bir menü oluşturduk. Tabi buna birde fare üzerine  geldiğindeki durumu ekleyerek daha belirgin bir hale getirebiliriz.</p>
<pre class="brush: css; title: ; notranslate">
li#mAnasayfa a:hover{background-position:0 -40px;}
li#mUrunler a:hover{background-position:-120px -40px;}
li#mHizmetler a:hover{background-position:-240px -40px;}
li#mBizeUlasin a:hover{background-position:-360px -40px;}
</pre>
<p>Örneği görmek için <a href="/dokumanlar/basit_resimli_menu.html">tıklayınız</a></p>
<p><strong>Not: Ardalan konumu belirleme</strong>
</p>
<p><img src="/images/basit_resimli_menu_ardkaydi.jpg" width="480" height="80" /></p>
<p>Sistem  yukarıdaki mantık ile yürür. Genişliği ve yüksekliği belli olan alanın  genel resimdeki konumunu belirterek menümüzü oluşturduk. Yukarıdaki  örnek resimde &#8220;Ürünler&#8221;in fare üzerine geldiğindeki(:hover) görüntüsünü  elde etmek için resimdeki konumu yukarıdan -40px, soldan -120px olarak  atamalıyız. Ardalan konumu belirlerken resmin sıfır noktası sol üst  köşesidir, bu nedenle değerler eksi(-) değer alır.</p>
<h2>Kaynaklar</h2>
<ul>
<li><a title="http://www.webdesignerwall.com/tutorials/advanced-css-menu/" href="http://www.webdesignerwall.com/tutorials/advanced-css-menu/" >http://www.webdesignerwall.com/tutorials/advanced-css-menu/</a></li>
<li><a title="http://superfluousbanter.org/archives/2004/05/navigation-matrix-reloaded/" href="http://superfluousbanter.org/archives/2004/05/navigation-matrix-reloaded/" >http://superfluousbanter.org/archives/2004/05/navigation-matrix-reloaded/</a></li>
<li><a title="http://www.3point7designs.com/blog/2006/07/24/accessible-css-roll-over-images/" href="http://www.3point7designs.com/blog/2006/07/24/accessible-css-roll-over-images/" >http://www.3point7designs.com/blog/2006/07/24/accessible-css-roll-over-images/</a></li>
<li><a title="http://simplebits.com/notebook/2003/09/30/accessible_imagetab_rollovers.html" href="http://simplebits.com/notebook/2003/09/30/accessible_imagetab_rollovers.html" >http://simplebits.com/notebook/2003/09/30/accessible_imagetab_rollovers.html</a></li>
<li><a title="http://inobscuro.com/tutorials/read/19/" href="http://inobscuro.com/tutorials/read/19/" >http://inobscuro.com/tutorials/read/19/</a> 
    </li>
<li><a title="http://dragan.yourtree.org/blog/en/2007/04/10/pure-css-rollover-menu/" href="http://dragan.yourtree.org/blog/en/2007/04/10/pure-css-rollover-menu/" >http://dragan.yourtree.org/blog/en/2007/04/10/pure-css-rollover-menu/</a></li>
<li><a title="http://www.webvamp.co.uk/blog/coding/css-image-rollovers/" href="http://www.webvamp.co.uk/blog/coding/css-image-rollovers/" >http://www.webvamp.co.uk/blog/coding/css-image-rollovers/</a></li>
<li><a title="http://www.codeitred.com/2008/08/12/apple-style-menu-tutorial-css-sprites" href="http://www.codeitred.com/2008/08/12/apple-style-menu-tutorial-css-sprites" >http://www.codeitred.com/2008/08/12/apple-style-menu-tutorial-css-sprites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fatihhayrioglu.com/basit-resimli-menu-yapmak/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss>

