diff --git a/content/odin/intermediate_html_css/intermediate_css_concepts/advanced_selectors.md b/content/odin/intermediate_html_css/intermediate_css_concepts/advanced_selectors.md index fa599136..9b894a1f 100644 --- a/content/odin/intermediate_html_css/intermediate_css_concepts/advanced_selectors.md +++ b/content/odin/intermediate_html_css/intermediate_css_concepts/advanced_selectors.md @@ -1,29 +1,29 @@ -### Introduction +### Giriş -By now you should be comfortable with basic CSS selectors and have no trouble grabbing things by their type, class or ID. But to be a real CSS surgeon, sometimes you need more specialized tools. In this lesson we'll look at advanced CSS selectors and show you how to target elements in a more specific and finely grained way. +Bu noktada temel CSS seçicileriyle rahat hissetmelisiniz ve tür, sınıf veya kimliğine göre öğeleri seçmede zorluk yaşamamalısınız. Ancak gerçek bir CSS cerrahı olabilmek için bazen daha özelleşmiş araçlara ihtiyaç duyarsınız. Bu dersimizde, gelişmiş CSS seçicilerine göz atacak ve öğeleri daha spesifik ve ince bir şekilde hedeflemenin yollarını göstereceğiz. -These selectors can be especially useful when you can't (or don't want to) change your HTML markup. +Bu seçiciler, HTML işaretleminizi değiştiremiyorsanız (veya değiştirmek istemiyorsanız) özellikle kullanışlı olabilir. -There are _a lot_ of advanced selectors, so going through every single one is outside the scope of this lesson. However, we'll go through some of the most useful and common ones, as well as arm you with the concepts and vocabulary to learn more on your own. +Gelişmiş seçici sayısı oldukça fazla olduğundan, her birini ayrıntılı bir şekilde ele almak bu dersin kapsamı dışındadır. Bununla birlikte, en kullanışlı ve yaygın olanları üzerinden geçecek ve kendi başınıza daha fazlasını öğrenmek için kavramları ve kelime dağarcığınızı güçlendireceğiz. -As always feel free to open up your code editor and run your own experiments with these selectors - practice makes perfect! +Her zamanki gibi kod düzenleyicinizi açıp bu seçicilerle kendi deneylerinizi yapmaktan çekinmeyin - pratik mükemmelleştirir! -### Learning outcomes +### Öğrenme çıktıları -* Understand how to use parent and sibling selectors -* Recognize the difference between pseudo classes and pseudo elements -* Learn about some of the most useful and common pseudo elements and pseudo classes -* Learn about the different ways to select an attribute or its parts +* Ebeveyn ve kardeş seçicilerini nasıl kullanılacağını anlayın. +* Yalancı sınıf ve yalancı öğe arasındaki farkı tanıyın. +* En kullanışlı ve yaygın yalancı öğeleri ve yalancı sınıfları öğrenin. +* Bir özniteliği veya onun bölümlerini seçmek için farklı yöntemleri öğrenin. -### Child and sibling combinators +### Çocuk ve kardeş birleştiricileri -Let's have a look at some more ways we can access different elements _without_ referring to their classes. Here are three new selectors to do just that. +Farklı öğelere başvururken sınıflarına başvurmadan kullanabileceğimiz başka yolları inceleyelim. İşte bunu yapmak için üç yeni seçici. -* `>` - the child combinator -* `+` - the adjacent sibling combinator -* `~` - the general sibling combinator +* `>` - çocuk birleştirici +* `+` - bitişik kardeş birleştirici +* `~` - genel kardeş birleştirici -We'll tackle some practical examples using this sample markup. +Bu örnek işaretleme kullanarak bazı pratik örnekleri ele alacağız. ```html
@@ -39,7 +39,7 @@ We'll tackle some practical examples using this sample markup.
``` -By now, you should be pretty comfortable writing rules using the descendant combinator you learned about in [intro to CSS](https://www.theodinproject.com/lessons/foundations-intro-to-css). For instance, if we wanted to select all the `child` and `grand-child` divs inside of `main`, we could write: +Bu noktada, [intro to CSS](https://www.theodinproject.com/lessons/foundations-intro-to-css) 'de öğrendiğiniz soy birleştiriciyi kullanarak kurallar yazmada oldukça rahat olmalısınız. Örneğin, `main` içindeki tüm `child` ve `grand-child` div'lerini seçmek istiyorsak şu şekilde yazabiliriz: ```css main div { @@ -47,7 +47,7 @@ main div { } ``` -But what if we wanted to be more specific and select _only_ the `child` or `grand-child` divs? That's where the child combinator `>` comes in handy. Unlike the descendant combinator, it will only select direct children. +Ancak daha spesifik olmak istersek ve sadece `child` veya `grand-child` div'lerini seçmek istersek, çocuk birleştirici `>` işe yarar. Soy birleştiriciye benzemez, yalnızca doğrudan çocukları seçer. ```css /* This rule will only select divs with a class of child */ @@ -61,7 +61,7 @@ main > div > div { } ``` -Phrased another way, the child selector will select an element that is one level of indentation down. In order to select an element that is adjacent to our target, or on the same level of indentation, we can use the adjacent sibling combinator `+`. +Başka bir deyişle, çocuk seçici, bir düzey içeriğe sahip bir öğeyi seçecektir. Hedefimize bitişik veya aynı düzeydeki bir öğeyi seçmek için bitişik kardeş birleştirici `+` kullanabiliriz. ```css /* This rule will only select the div with the class child group2 */ @@ -75,8 +75,7 @@ Phrased another way, the child selector will select an element that is one level } ``` -Finally, if we want to select all of an element's siblings and not just the first one, we can use the general sibling combinator `~`. - +Son olarak, bir öğenin tüm kardeşlerini seçmek istiyorsak ve sadece ilk olanı değilse, genel kardeş birleştirici `~` kullanabiliriz. ```css /* This rule will select all of .group1's siblings - in this case the 2nd and 3rd .child divs */ .group1 ~ div { @@ -84,35 +83,35 @@ Finally, if we want to select all of an element's siblings and not just the firs } ``` -Just like the descendant combinator, these selectors don't have any special specificity rules - their specificity score will just be made up of their component parts. +Descendant birleştirici gibi, bu seçicilerin özel öncelik kuralları yoktur - öncelik skorları yalnızca bileşen parçalardan oluşacaktır. -This [MDN article on combinators](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Combinators) provides a good overview if you want to learn more about them. +Eğer daha fazlasını öğrenmek istiyorsanız, [this MDN article on combinators](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Combinators) size iyi bir genel bakış sunar. -### Pseudo-selectors +### Yalancı Seçiciler (Pseudo-selectors) -Before diving into pseudo-selectors, a quick note on the difference between [pseudo-elements and pseudo-classes](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Pseudo-classes_and_pseudo-elements). Pseudo-class selectors are prefixed with a single colon and are a different way to target elements that already exist in HTML. Pseudo-elements are prefixed with two colons and are used to target elements that _don't_ normally exist in the markup. If that doesn't make sense straight away, don't worry - we'll explore some examples below. +Yalancı seçicilere dalmadan önce, [pseudo-elements and pseudo-classes](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Pseudo-classes_and_pseudo-elements) üzerine kısa bir not. Pseudo-class seçicileri tek iki nokta üst üste ile öne eklenir ve zaten HTML'de var olan öğeleri hedefleme farklı bir yoludur. Pseudo-elements iki iki nokta üst üste ile öne eklenir ve genellikle işaretleme normalde olmayan öğeleri hedeflemek için kullanılır. Eğer bu hemen anlaşılır gelmiyorsa, endişelenmeyin - aşağıda bazı örnekleri keşfedeceğiz. -### Pseudo-classes +### Yalancı Sınıflar (Pseudo-classes) -Pseudo-classes offer us different ways to target elements in our HTML. There are quite a lot of them, and they come in a couple of different flavors. Some are based on their position or structure within the HTML. Others are based on the state of a particular element, or how the user is currently interacting with it. There are too many to cover in detail here but we'll have a look at some of the most useful ones. Pseudo-classes share the same specificity as regular classes (0, 0, 1, 0). Just like regular classes, most can be chained together. +Yalancı sınıflar bize HTML'deki öğeleri hedefleme farklı yolları sunar. Bunlardan bir hayli fazla sayıda ve birkaç farklı çeşidi vardır. Bazıları HTML içindeki konumlarına veya yapısına dayanır. Diğerleri belirli bir öğenin durumuna veya kullanıcının şu anda nasıl etkileşimde bulunduğuna dayanır. Bunların hepsini burada detaylı bir şekilde ele almak mümkün değildir, ancak en kullanışlı olanlara bir göz atacağız. Yalancı sınıflar, düzenli sınıflarla aynı önceliğe sahiptir (0, 0, 1, 0). Düzenli sınıflar gibi, çoğu bir araya getirilebilir.
-The (0,0,1,0) above is the notation for calculating specificity. To find out more about how it works, glance over the "Calculating CSS Specificity Value" section from [this article on CSS Specificity](https://css-tricks.com/specifics-on-css-specificity/). +Yukarıdaki (0,0,1,0), öncelik hesaplama için bir notasyondur. Nasıl çalıştığı hakkında daha fazla bilgi edinmek için [this article on CSS Specificity](https://css-tricks.com/specifics-on-css-specificity/) başlıklı makalenin "Calculating CSS Specificity Value" bölümüne göz atın.
-As always don't forget to check the [docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) to see a complete picture of what's available. +Her zamanki gibi mevcut olanakların tam resmini görmek için [docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) göz atmayı unutmayın. -#### Dynamic and user action pseudo-classes +#### Dinamik ve Kullanıcı Eylemi Yalancı Sınıflar -These types of useful pseudo-classes can make your page feel much more dynamic and interactive. +Bu tür yararlı yalancı sınıflar, sayfanızın çok daha dinamik ve etkileşimli hissetmesini sağlayabilir. -[`:focus`](https://css-tricks.com/almanac/selectors/f/focus/) applies to an element that is currently selected by the user either through selecting it with their cursor or using their keyboard. +[`:focus`](https://css-tricks.com/almanac/selectors/f/focus/), kullanıcının şu anda faresiyle seçtiği veya klavyesini kullanarak seçtiği bir öğeye uygulanır. -[`:hover`](https://css-tricks.com/almanac/selectors/h/hover/) will affect anything under the user's mouse pointer. It can be used to give extra oomph to buttons and links to highlight that they're interactable, or to trigger a drop-down menu. +[`:hover`](https://css-tricks.com/almanac/selectors/h/hover/) kullanıcının fare işaretçisinin altındaki her şeyi etkiler. Bu, düğmelere ve bağlantılara etkileşimli olduklarını vurgulamak veya bir açılır menüyü tetiklemek için kullanılabilir. -[`:active`](https://css-tricks.com/almanac/selectors/a/active/) applies to elements that are currently being clicked, and is especially useful for giving your user feedback that their action had an effect. This is a great one to give your buttons and other interactive elements more 'tactile' feedback. +[`:active`](https://css-tricks.com/almanac/selectors/a/active/), şu anda tıklanan öğelere uygulanır ve kullanıcının eyleminin bir etkisi olduğuna dair geri bildirim sağlamak için özellikle kullanışlıdır. Bu, düğmelerinize ve diğer etkileşimli öğelere daha fazla 'dokunsal' geri bildirim sağlamak için harika bir seçenektir. -Have you ever wondered why links are blue but turn purple when clicked in unstyled HTML? It's because browsers implement that styling by default. To implement your own custom styling for links, take advantage of the [`:link`](https://css-tricks.com/almanac/selectors/l/link/) and [`:visited`](https://css-tricks.com/almanac/selectors/v/visited/) pseudo-classes. A simplified version of default browser styling might look something like this: +Hiç düşündünüz mü, neden bağlantılar standart HTML'de mavi iken tıklanınca mor oluyor? Bu, tarayıcıların varsayılan olarak bu stillemeyi uygulamasından kaynaklanır. Bağlantılar için kendi özel stilinizi uygulamak için [`:link`](https://css-tricks.com/almanac/selectors/l/link/) ve [`:visited`](https://css-tricks.com/almanac/selectors/v/visited/) yalancı sınıflarından faydalanın. Varsayılan tarayıcı stillemesinin basitleştirilmiş bir versiyonu şöyle görünebilir: ```css /* This rule will apply to all links */ @@ -131,19 +130,19 @@ Have you ever wondered why links are blue but turn purple when clicked in unstyl } ``` -#### Structural pseudo-classes +#### Yapısal Yalancı Sınıflar -Structural pseudo-classes are a powerful way to select elements based on their position within the DOM. +Yapısal yalancı sınıflar, öğeleri DOM içindeki konumlarına göre seçmenin güçlü bir yoludur. -[`:root`](https://css-tricks.com/almanac/selectors/r/root/) is a special class that represents the very top level of your document - the one element that has no parents. Generally when working with the web, this is equivalent to the `html` element, but there are a [few subtle differences](https://stackoverflow.com/questions/15899615/whats-the-difference-between-css3s-root-pseudo-class-and-html). +[`:root`](https://css-tricks.com/almanac/selectors/r/root/), belgenizin en üst düzeyini temsil eden özel bir sınıftır - hiç ebeveyni olmayan tek öğe. Genellikle web ile çalışırken, bu genellikle `html` elementine eşdeğerdir, ancak [birkaç ince fark vardır](https://stackoverflow.com/questions/15899615/whats-the-difference-between-css3s-root-pseudo-class-and-html). -`:root` is generally the place where you will place your 'global' CSS rules that you want available everywhere - such as your custom properties and CSS variables, or rules such as `box-sizing: border-box;`. +`:root` genellikle her yerde kullanılabilir olmasını istediğiniz 'global' CSS kurallarınızı koymak için yerdir - örneğin, özel özellikleriniz ve CSS değişkenleriniz veya `box-sizing: border-box;` gibi kurallar. -[`:first-child`](https://css-tricks.com/almanac/selectors/f/first-child/) and [`:last-child`](https://css-tricks.com/almanac/selectors/l/last-child/) will match elements that are the first or last sibling. +[`:first-child`](https://css-tricks.com/almanac/selectors/f/first-child/) ve [`:last-child`](https://css-tricks.com/almanac/selectors/l/last-child/), ilk veya son kardeş olan öğelerle eşleşecektir. -Similarly, [`:empty`](https://css-tricks.com/almanac/selectors/e/empty/) will match elements that have no children at all, and [`:only-child`](https://css-tricks.com/almanac/selectors/o/only-child/) will match elements that don't have any siblings. +Benzer şekilde, [`:empty`](https://css-tricks.com/almanac/selectors/e/empty/), hiç çocuğu olmayan öğelerle eşleşir ve [`:only-child`](https://css-tricks.com/almanac/selectors/o/only-child/) hiçbir kardeşi olmayan öğelerle eşleşir. -For a more dynamic approach we can use [`:nth-child`](https://css-tricks.com/almanac/selectors/n/nth-child/). This is a flexible pseudo-class with a few different uses. +Daha dinamik bir yaklaşım için [`:nth-child`](https://css-tricks.com/almanac/selectors/n/nth-child/)'i kullanabiliriz. Bu, birkaç farklı kullanımı olan esnek bir yalancı sınıftır. ```css .myList:nth-child(5) {/* Selects the 5th element with class myList */} @@ -155,17 +154,17 @@ For a more dynamic approach we can use [ .myList:nth-child(even) {/* Selects every even element with class myList */} ``` -### Pseudo-elements +### Yalancı Öğeler (Pseudo-elements) -While pseudo-classes give us an alternative way to interact with our HTML elements based on their state or structure, pseudo-elements are more abstract. They allow us to affect parts of our HTML that aren't elements at all. These special elements share the same specificity as regular elements (0, 0, 0, 1). There are a number of useful pseudo-elements that can be utilized in any number of creative ways. +Yalancı sınıflar, HTML öğelerimizle etkileşimde bulunmanın alternatif bir yolunu sağlarken, yalancı öğeler daha soyuttur. Bize hiçbir öğe olmayan HTML parçalarını etkilememize olanak tanır. Bu özel öğeler, düzenli öğelerle aynı önceliğe sahiptir (0, 0, 0, 1). Her türlü yaratıcı şekilde kullanılabilen bir dizi yararlı yalancı öğe bulunmaktadır. -[`::marker`](https://css-tricks.com/almanac/selectors/m/marker/) allows you to customize the styling of your `
  • ` elements' bullets or numbers. +[`::marker`](https://css-tricks.com/almanac/selectors/m/marker/), `
  • ` öğelerinizin madde işaretlerini veya numaralarını özelleştirmenize olanak tanır. -[`::first-letter`](https://css-tricks.com/almanac/selectors/f/first-letter/) and [`::first-line`](https://css-tricks.com/almanac/selectors/f/first-line/) allow you to (you guessed it!) give special styling to the first letter or line of some text. +[`::first-letter`](https://css-tricks.com/almanac/selectors/f/first-letter/) ve [`::first-line`](https://css-tricks.com/almanac/selectors/f/first-line/), bir metnin ilk harfini veya satırını (siz tahmin ettiniz!) özel bir stil vermenize olanak tanır. -[`::selection`](https://css-tricks.com/almanac/selectors/s/selection/) allows you to change the highlighting when a user selects text on the page. +[`::selection`](https://css-tricks.com/almanac/selectors/s/selection/), kullanıcının sayfa üzerinde metin seçtiğinde vurgulamayı değiştirmenize olanak tanır. -[`::before` and `::after`](https://css-tricks.com/almanac/selectors/a/after-and-before/) allow us to add extra elements onto the page with CSS, instead of HTML. Using it to decorate text in various ways is one common use case. +[`::before` ve `::after`](https://css-tricks.com/almanac/selectors/a/after-and-before/), HTML yerine CSS ile sayfaya ekstra öğeler eklememize izin verir. Metni çeşitli şekillerde süslemek için kullanma, yaygın bir kullanım alanıdır. ```html