Daha İyi CSS Kodu Yazmak İçin 8 İpucu

Yazımızdaki 8 ipucu verimli, anlaşılır ve kullanışlı bir CSS yazmanıza yardımcı olacaktır. Daha iyi bir CSS yazmak, sizi çok da zorlayacak bir konu değil. CSS kod dosyanız içerisinde nasıl çalıştığınıza ilişkin birkaç küçük ipucunun büyük etkilerini göreceksiniz. CSS becerilerinizi geliştirebileceğiniz ve daha anlaşılır, daha verimli ve daha kullanışlı CSS kodları yazabileceğiniz sekiz basit ipucuna göz atacağız.

- 15-09-2020 16:18

1.CSS’i Sıfırlayarak Başlayın

Bazıları CSS Sıfırlamanın gereksiz olduğunu düşünebilir. Bu düşüncenin aksine, CSS Sıfırlama özelliği, temiz bir temelle başlamanıza olanak sağlar ve böylece web sitenize stil kazandırmayı kolaylaştırır Mechanical Pencils.

CSS Reset resets or overrides the browser’s default styles. You can write your own, use one of the many resets available online, or use a combination of the two.

2. Know Where to Use CSS Shortcuts

CSS shortcuts allow you to set multiple properties of an item on a single line. Using Shorthand saves space and takes less time to load. However, you should not always use it.

Sometimes longhand provides much needed clarity. But more importantly, it might be better if you only need to set one or two properties – or just need to override something.

Another thing to remember: when using the shorthand , the invalid features are reset, which can cause an undesirable effect.

 

3. Use DRY Methodology

The best advice to write better CSS code can be followed by following the DRY methodology. DRY stands for ‘self repetition’, do not use the same pieces of code over and over again.

One way to store DRY in CSS is to group it. Let’s look at an example.

.menu li { color: red; } .menu li a { color: red; }

 

Günün Diğer Haberleri