Тёмный

5 CSS mistakes that I see way too often 

Kevin Powell
Подписаться 907 тыс.
Просмотров 359 тыс.
50% 1

People make mistakes and learn some bad habits when learning CSS, so in this video I tackle 5 of the most common fouls (plus a bonus one at the end if you stick around), that I see on a regular basis.
The a11y project: a11yproject.com/
Specific article about outline: a11yproject.com/posts/never-r...
Many of these are bad habits that people start developing as a beginner and then never drop, while others are things that people never really get into. And while many of these mean taking a little bit of extra time initially, following best practices is a great way to get better at CSS as well!
#css
---
Come and hangout, ask questions, suggest ideas, and meet some awesome people over in The Community: / discord
I have a newsletter! www.kevinpowell.co/newsletter
I've been working on some courses! Find out more: www.kevinpowell.co/courses
---
My Code Editor: VS Code - code.visualstudio.com/
How my browser refreshes when I save: • How to automatically r...
---
Support me on Patreon: / kevinpowell
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my RU-vid channel, make sure to follow me on Instagram and Twitter.
Instagram: / kevinpowell.co
Twitter: / kevinjpowell
Codepen: codepen.io/kevinpowell/
Github: github.com/kevin-powell

Опубликовано:

 

17 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 604   
@facundocorradini
@facundocorradini 4 года назад
Great tips! A word of advice on refactoring: be careful with those comma-separated selectors. If a browser doesn't recognise a selector on the list it will discard the whole rule, turning a small issue into a much bigger one. So avoid using browser-specific o any advanced / recently developed selector on those lists.
@KevinPowell
@KevinPowell 4 года назад
Great point! And no trailing commas either... I've done that before
@cowboyfrankspersonalvideos8869
@cowboyfrankspersonalvideos8869 4 года назад
Excellent. I allays try to make sure that any effects I use to make a page "pretty", won't interfere with reading or navigating if that effect doesn't work correctly.
@WyzrdCat
@WyzrdCat 4 года назад
Damn never knew that one!
@TNeulaender
@TNeulaender 4 года назад
Only a problem until houdini gets widely used in browsers :)
@carolmckay5152
@carolmckay5152 4 года назад
I learnt this recently with :focus-within.
@BasvanderVeeken
@BasvanderVeeken 4 года назад
00:00 Introduction 00:25 #1 Overly complicated selectors 05:23 #2 Make your CSS readable 07:33 #3 Keep your CSS organized 10:58 #4 Refactor your CSS 13:07 #5 Removing the outline 17:24 Bonus: Text contast is too low
@gastonbengolea6018
@gastonbengolea6018 4 года назад
thanks
@AmodeusR
@AmodeusR 3 года назад
It's a nice touch when we need to review the content but not wanting to watch everything from the beginning :D Thank you!
@aarontheeranitpongtongmuan233
@aarontheeranitpongtongmuan233 2 года назад
Thank you so much.
@ernestomercado8176
@ernestomercado8176 2 года назад
Hero
@braveshine2579
@braveshine2579 2 года назад
thanks
@malcolmrodrigues911
@malcolmrodrigues911 4 года назад
One trick I always use for css files with vs code is using regions. Really straight forward : /* #region _optional-name_ */ .css{} /* #endregion _optional-name_ */ Not only does this make it easier to segregate and organize your code, but vs code also allows you to collapse a region just like any JavaScript or HTML block, which in the long run helps you scroll through lengthy css files.
@JanKosowski
@JanKosowski 4 года назад
19:00 The BIG reason to avoid a single-line CSS is that if you work with other people using a version control system like Git, it will make your changes much harder to read. The whole line will be highlighted as changed, which makes it annoying to look for what has actually changed. The same about debugging, when you get an issue in "line 331". It's ok to use a single line CSS if it's a single rule like .hide { display: none; } although staying with one convention may be easier for your brain in the long run.
@sarfraznawaz7248
@sarfraznawaz7248 4 года назад
Greetings from Pakistan Kevin, im a bank teller trying really hard to change my career by learning web development and your videos have been extremely helpful for me. Keep up the good work man.
@PrinceJJGoated
@PrinceJJGoated 4 года назад
Good luck man!
@cosmicegg1283
@cosmicegg1283 4 года назад
Luck mate
@jawad9757
@jawad9757 4 года назад
I wish you well on your journey
@mohamedhasen7454
@mohamedhasen7454 3 года назад
Good luck man
@lloydthomas4481
@lloydthomas4481 4 года назад
I've been guilty for removing the outline. Adding the :focus to the elements is a really neat trick. Also, I never noticed the contrast warning in Dev tools. Great tutorial as always. I always learn something new x
@soniablanche5672
@soniablanche5672 4 года назад
Today I learned Shift+Tab does the reverse of Tab. LOL
@KevinPowell
@KevinPowell 4 года назад
Awesome! I have no idea how I learned that, but I'm so happy that I did, lol.
@DutchRatedGamers
@DutchRatedGamers 4 года назад
However don't try to have it connected to Steam.. The overlay will pop up. -- Dunno why, but some people even connect their IDE to Steam.
@liondeluxe3834
@liondeluxe3834 3 года назад
I had to search it up last week because I hated manually unindenting code
@sobanya_228
@sobanya_228 3 года назад
@@DutchRatedGamers It's a little hilarious when something like "playing Visual Studio Code" pops up. That one I've seen on discord a lot.
@allie-howe
@allie-howe 3 года назад
Shift is often the reverse-command button - Alt+Tab moves forward in recently opened tabs, Alt+Shift+Tab moves back. Ctrl+Tab in browsers changes to tab on the right, Ctrl+Shift+Tab moves left Also it's why Ctrl+Shift+Z should be redo, not Ctrl+Y. Looking at you, MS Office.
@robpuchyr7407
@robpuchyr7407 3 года назад
2:48 Strongly disagree. Using classes for everything just causes classitis. You even said it means more coding in HTML. Too many glasses. I’d rather only class a list or a table as whole in one place without coding list items or rows and cells. Why code classes for every list item or every table row or table cell when you can simply class the list or table and have the CSS do the work? This way, I can change the look or behaviour of a table by just changing the table’s class without recoding rows and cells too. More coding in HTML is not worth a little readability in CSS, especially if you have multiple HTML authors in your team. Apart from that, great video.
@stevestefler880
@stevestefler880 2 года назад
Main aim for CSS was to get rid of ton coding in html. If you type classes for every tags, you can also write all styles in html, why to bother to do it in css at all? Also most of author conclusions are stupid, starting with first one: making it more "readable" makes it hard to manage/add/edit without rebuilding,
@williamhorn411
@williamhorn411 2 года назад
I don't think that's what he meant by "use classes for everything". Obviously if you have a list, for example, it would be best to style the list and select it's children than manually assign the children their styles. When he says "use classes for everything", I'm pretty sure that was in context to getting rid of unnecessary/overly complicated selectors.
@TheElkster
@TheElkster 4 года назад
This type of video is so, so helpful! I've always seen the complicated selector format and have agonized over it (not always understanding it fully), so now you have explained that it isn't even necessary, it has helped me no end!!!!! I'd certainly love to see another video with this type of content! Way to go, Kevin
@filipe.webber
@filipe.webber 3 года назад
I’m really glad I found your channel. It’s improving my understanding of css a lot! Thank you for taking the time to record these videos.
@jennifertran3830
@jennifertran3830 4 года назад
Thanks Kevin! Just discovered you - and I must say, I have a feeling that your content will answer many of my best practice questions, and hopefully after going through your videos, I should be more confident and actually pursue web design! I used to do it in middle school w/ myspace - little did I know, this is an actual career!
@SaleKnezevic
@SaleKnezevic 4 года назад
The :focus one is quite neat, kudos Mr.Powell. Great as always.
@BaldiGiovanni
@BaldiGiovanni 4 года назад
Very useful tips, especially the one on focus. I would love to see more on files architecture and writing comments in SCSS. I'm currently following the Sass guidelines but struggle to apply them to complex projects.
@michaeloosthuizen2383
@michaeloosthuizen2383 4 года назад
One line rules.... wow, that brought back memories. I still tend to do that for single prop rules as a short hand, but thankfully I don't write much CSS anymore.
@MikkoRantalainen
@MikkoRantalainen 2 года назад
4:00 A nice trick to create custom checkboxes is to set checkbox colors to transparent and then render the custom checkbox in pseudoelement. Then you can just use selector [type=checkbox]:checked::before to style the custom display.
@johnswanson217
@johnswanson217 3 года назад
I've never thought about that last one!! It's about accessibility and it seems important. Thank you.
@harmonicresonanceproject
@harmonicresonanceproject 2 года назад
I'm finding this channel incredibly helpful in my CSS journey. Thanks!
@gempio2634
@gempio2634 2 года назад
I'm coming from a backend background so proper spacing in front end code so that it follows language standards is difficult. What really helped me was installing a formatter plugin and setting it up such that it formats the code every time I press ctrl+save. This way no one can ever complain that I didn't take care about my formatting. Highly recommend it to everyone.
@abrahamf6124
@abrahamf6124 4 года назад
This was so helpful, I do organized my stylesheet but not enough, this was a great reminder
@knightfallgame
@knightfallgame 3 года назад
I want to thank you Mr. Powell. your videos are a tremendous help to me in my advancement in css. Its been by far the most challenging part of my progress as a web developer. Id be lost without your help and so you have my thanks.
@kerryoneill1210
@kerryoneill1210 4 года назад
Thank you so much for these tips. Being new to CSS...I've come across many templates that use Foul #2 and Foul #3 (Organising the CSS). I've spent hours in reformatting the CSS so that I can understand it and know what the CSS is doing.
@adrianbona
@adrianbona 3 года назад
The end about the focus was such an eye opening thing to me!
@terryg4415
@terryg4415 4 года назад
Love this, thank you. 35 years ago when I was learning to program, my teachers emphasized readability, commenting, etc, and back then, it was “structured” code, and it still annoys me to see code of any sort that isn’t organized well. Now, learning CSS, this is so helpful to me.
@KevinPowell
@KevinPowell 4 года назад
It's so easy to be lazy, but in the long run it saves you so much time, and makes anyone your working with love you, lol
@Morrile1
@Morrile1 4 года назад
Once again you talk about things others do not, very positive, love it, thanks
@VeitLehmann
@VeitLehmann Год назад
Most of the fouls you mentioned are what we used to do in my first professional job 15 years ago: Preferring IDs, deeply nested selectors to scope everything, and even having all the properties in the same line (we used a CMS which didn't support minification, so we wrote minified code 🙈). I didn't like that and I was really happy when Nicole Sullivan came along and proposed one of the first CSS methodologies, OOCSS, which really resonated with me and was close to what I used to do: Composable classes with low specificity, named according to what I like to call visual semantics! And it's still the way to go today most of the time. Also, regarding using IDs and element names for styling: It happened quite a few times that I suddenly had to have two instances of #sidebar on the same page with the same styles. And, of course, that I needed to style a link like a button or a paragraph like a heading. So, classes for the rescue.
@Anakin1990Skywalker
@Anakin1990Skywalker 2 года назад
Great tips! Thank you Kevin for every thing you’re sharing. I’m a beginner front-end and I find these tips very useful. Cheers!
@rachanaa6745
@rachanaa6745 2 года назад
Much needed topic ! especially when we are working in a collaborative project with multiple UI folks.... Feeling to share the tips with my team... great compilation of topics here... thanks !!
@miguelagawin
@miguelagawin 4 года назад
Thank you! And thank you RU-vid for finally getting useful content on my feed.
@AbdulKader-jt5gd
@AbdulKader-jt5gd 3 года назад
Helped me a lot. Thanks Kevin Powell.
@Shrinehi1
@Shrinehi1 4 года назад
Thanks! If found the discussion on focus styling helpful.
@julienbongars4287
@julienbongars4287 4 года назад
Great video but there are some things I would like to add to this:- 1. Overly complicated selectors I generally agree with this statement but there is a lot wrong with the way you explain it. Firstly, you should not be naming. every. single. html node in your project. There have been waaaay too many times I had to step in to maintain a legacy web application and see classes like this: nav-menu-item-button-alt-clicked. It's not necessary and it's not worth it. Why? because you styles are going to start leaking into you html and overall make your life (or the people you work with's lives) difficult. Too much, DO NOT do this. You can have generic selectors such as .navigation > btn.clicked. If you think this is hard, you should use scss or less. No one is going to judge you for using webpack or a preprocessor. In fact most websites use preprocessors and so should you. ALWAYS ALWAYS avoid using general or universal selectors at the root of any declared style. selectors like * > div or html are (in my books) very bad practice because it means your styles are uncontained and can cause side effects if your element or page is injected into a different css project. One final point is that I almost never read back css on my IDE but rather, I use element selectors on the browser. If you become proficient in this, you will find it becomes easier to understand the 500 lines of spaghetti that is hitting your element. You can be the cleanest developer in the world but CSS and SCSS are naturally very messy languages and it's ok if there are more than a couple of selectors hitting a particular element. Just be smart about it. 2, 3, 4. Make your CSS readable If you are spending even a couple of minutes to refactor your CSS, JS, Haskell, Cpp, anything, you are wasting your time. You will save so much time if you just installed a linter (like prettier which you already mentioned) and just factoring your code that way. Don't like the way your linter is factoring code? Just configure it using a .prettierrc or otherwise. Using a linter is good for three reasons, (1) is it forces a standard way to format your code in a team, (2) is it catches careless mistakes or bad practices as you are typing them but most importantly (3) is you save so much time! I almost never press "enter" as I am coding these days but my code stays clean because I use a linter. It is the best. If you are lost, install VS Code and use that. It comes with a tonne of linters preinstalled and the process of installing new linters is extremely easy. I remember one of the first projects I completed was a static website I used to promote myself a couple of years back. It had about 500 lines of HTML and about 20000 lines of CSS. No matter how hard I tried to keep it organised, it was always messy and difficult to maintain. Now imagine working in a team where 5 devs are in the office, 5 devs are MIA and 5 devs are working remote over a couple of years? Things are going to get messy. Use technology to deal with this. Use CSS-modules to refactor your CSS into manageable chunks that only target parts of the page. Remember when I mentioned not using universal selectors? This carries on here as you want whatever is written in each module to remain in each module. Segregate by real estate, not by logic. It also helps to keep your design minimal and consistent to maximize re usability. Again, preprocessors like SCSS or LESS helps a lot here. Just don't get carried away. DO NOT just comment all willy nilly. The more you comment, the more comments you have to maintain and there is nothing worse than lying comments. If you structure your code correctly, you will find it easy to read your CSS. If you think otherwise, you need to refactor your CSS before you think about comments. Comments should explain the why and not what or how. On a side note, if you are using VS Code, you have intellisense to tell you the hiarchy of selectors as you code along. One thing I definetly agree with you on is you should always refactor as you work. Always ask yourself if you are over complicating things, if you are inconsistent (suddenly using css grids when you have consistently been using flexboxes) and finding ways to make your code reusable with sacrificing readability are excellent practices in any language (I think you mentioned this already). At the same time, try not to write smart CSS. Just think, you have to be twice as intelligent to debug a block of code than you have to be to write it. Keep in mind what websites you are developing for but always remember you can use a preprocessor like bebel to apply polyfills to make your CSS compatible with your target browsers. 5. Overriding native behavior Yep totally agree with this. Try not to override native behaviors. Just because you can do it in CSS does not mean you should. In addition to the selector boxes, there is also smooth scrolling, caret color, the highlighter color, pop ups, etc... Actually I find this is more of a design thing then a development thing. Two things I would like to add, just imagine when you are using javascript to re-write something that is already available (such as a selector menu) you are spending time to write something that has already been done by someone smarter than you. Does this mean you should go crazy and download every dependency? No but that is something I can talk about for hours. Also, the more you write, the more can go wrong and the more you have to maintain, optimize and secure. This is the trade off you have to make. If you are struggling with starting new projects quickly, take the time to create a nice clean competent boilerplate which you can fork for any future projects. You shouldn't need to manually have to initialize new projects whenever you are given them. Don't be afraid to take shortcuts as long as they do not compromise the quality and integrity of the code. Lastly, you forgot the two biggest cardinal sin in CSS and that is using the !important sparingly or position absolute or pixel perfect CSS. For !important: yes, sometimes you need it (not because you can't but because of all the bad CSS and abundance of !important tags or inject-able elements. Do not do this! This is lazy! Really understand the problem you are fixing and fix it. Negotiate with your stakeholders to clean up the technical debt. They and you will thank each other later. For position absolute and pixel perfect CSS, trust the browser to position and paint the website for you. Just because it looks nice on your screen does not mean it will scale nice to your user's screen. It is also generally not reusable and very hard to debug. Yes sometimes, it can save you a lot of time, but don't over-rely on this. Use it sparingly. Anyway, this has been my thoughts and personal opinion. I hope this helps and didn't come across the wrong way but it is something I feel quite passionate about as a full stack developer. Do feel free to reply to this comment if you have any concerns, clarifications or questions. I'm a nice guy, really.
@patacon_king
@patacon_king 4 года назад
Wow, this is awesome, thank you! Do you know where (or how) can I learn about writing good CSS (or about things like BEM) (webpage, book, etc)? I'm a beginner and I've been struggling with CSS.
@ze_chooch
@ze_chooch 3 года назад
Creating custom focuses is a fantastic idea. Thank you!
@pastorcastillo970
@pastorcastillo970 4 года назад
Hello from Venezuela. You have Awesome channel. Would like some video dedicated to css effects for mobile. Thank you for being a teacher and sharing your knowledge...
@Konstantah888
@Konstantah888 4 года назад
Nice job Kevin, great advises👍
@vskand
@vskand 4 года назад
The :focus / outline tip is so simple yet so brilliant! Thanks
@Tiberiumgod
@Tiberiumgod 4 года назад
Thanks for the outlines and for your work.
@CrackerJayherber
@CrackerJayherber 3 года назад
I really appreciate all your work, thank you!
@work9167
@work9167 2 года назад
This is beautiful! It helped me to make my CSS code much more cleaner. Thank you!
@fastboy8703
@fastboy8703 4 года назад
I saw a few of ur videos and I must say that: Your keyboard is music to my ears :)
@cowboyfrankspersonalvideos8869
@cowboyfrankspersonalvideos8869 4 года назад
Contrast. My second biggest complaint about so many websites. We're going through the same thing from 20 years ago when some webmasters put dark blue writing on black backgrounds.
@clevermissfox
@clevermissfox 8 месяцев назад
Great tip about styling focus!! Thank you!
@_torgeek9108
@_torgeek9108 3 года назад
Finally I get a channel that will make my transition into front-end development easier. Thanks for the great video.
@kablamopow
@kablamopow 3 года назад
Thanks for the video, nice upload. Very clear and got all the points across well.
@andreaskarz
@andreaskarz Год назад
So, the first tipp I don't agree. I like the complete selectors in structure so it's better to understand. And in the moment, you have another link in the Nav but outside of a then you are safer wir the complete selectors
@ZackPyle
@ZackPyle 4 года назад
Thanks for the reminder to keep CSS clean! I just went in and added a Table of Contents to a really large style sheet I'm working on. Bonus: I added a ToC to my starter file as well so all future projects will have one as well!
@KevinPowell
@KevinPowell 4 года назад
That's awesome 👍
@omkay2569
@omkay2569 4 года назад
Good points. Most apply to all kinds of code. Some more tips from issues I've run into: 6. Not checking browser interoperability early in the project. I've implemented a whole layout with grids only to realise they aren't fully supported in IE9. Better to check this early and save yourself the headache of rewriting. 7. Not using box-sizing: border-box. CSS's default here was obviously the wrong way to style boxes because trying to put two 'width: 50%'s side by side can result in things wrapping falling off screen if you don't subtract the padding and border sizes. I don't know the arguments for content-box but I've never had an issue with border-box. I guess you have to be more careful with min-width and min-height since you need to account for padding and border. Meaning for a 10x10px image, min-width: 10px; will be too small if you don't add on border and padding. 8. Using too many divs. Divs are great for creating collections of elements to be all within the same box. But I far too often see divs redundant nested divs which appear to provide little or no value to the code. One big example I see a lot is using divs to apply a style to all its descendants. But this can and should be done with a class. The more divs you have, the harder it'll be to reason about the layout so strip them out where you can. 9. Along a similar vein, using divs where a better fit semantically would be a button/section/footer etc tag. This is more of a HTML issue but still involves resetting the existing elements CSS.
@KevinPowell
@KevinPowell 4 года назад
Very good ones! border-box is maybe the best thing ever, shame it's not the default, but at least it's not too hard to fix :)
@CyberTechBits
@CyberTechBits 2 года назад
@kevinpowell Kevin, another great tutorial BTW. How would you recommend organizing and overriding styles when using a css framework?
@adamonjourney3726
@adamonjourney3726 3 года назад
Helped a lot! Learned much! Thank you!
@a_l_o_k_1991
@a_l_o_k_1991 2 года назад
Removing the outline and replacing it with own CSS.....that was AWESOME tip !!
@blonduose
@blonduose 4 года назад
You are golden! NR 4 & 5 were especially useful. I think you can spot the "better" web developers also by how they keep and make their pages accessible, in my codecademy course there was nothing on accessibility and on freeCodeCamp there was a whole section. So I always know when someone pays special attention to that, that their content is good
@wimverpoorten3386
@wimverpoorten3386 4 года назад
Great tips. I would really, really advice everyone who has difficulty with this to use both Sass and BEM, which makes avoiding most of these pitfalls way easier than basic CSS.
@SergiuVacari
@SergiuVacari 4 года назад
Thank you, Kevin, especially for the :focus, really nice... I've noticed it before, didn't really know what's that, though it's kind of obvious, but you explained it well. Well done! Keep up the good work!
@KevinPowell
@KevinPowell 4 года назад
Thanks! Glad you liked it learned something along the way 😁
@SergiuVacari
@SergiuVacari 4 года назад
@@KevinPowell oh yes. I've learned a lot from you.
@yahilmadakiya
@yahilmadakiya 3 года назад
Nice tutorial, loved it. Which font you are using?
@kedigiller111
@kedigiller111 3 года назад
Removing the outline... that's was awesome tactics for me. Thanks a lot.
@joydevmaity1194
@joydevmaity1194 4 года назад
Thanks, Sir, You help me a lot. Great tutorials..
@rashikkarmacharya8023
@rashikkarmacharya8023 4 года назад
i was missing out on the focus and outline and surprisingly it never ever came to my mind. Good to know man!! . Cheers!!!. 18:22
@Asaloy
@Asaloy 3 года назад
outline is also important for handicapped persons.
@subish20me
@subish20me 3 года назад
sai vanyou sathi
@lenarnie2973
@lenarnie2973 2 года назад
thanks for giving new look to writing css
@randy918
@randy918 4 года назад
Wow. Searchable CSS table of contents. Never thought that one up. What a great idea
@samirdoncic6395
@samirdoncic6395 4 года назад
Just a week ago I started coding and first four Im doing right, except grouping, Im not grouping by element type, Im grouping by sections, everything that is in nav section will be in nav all buttons all texts, everything that is in main section will be grouped in main. Luckily I watched video till the end I learned few cool useful staff that I didnt know before, especially for contrast how to see if it is alright, yesterday I was killing myself for 1 hour I didn't know is my text readable because of contrast, now I know how to check it :) and also focus on tab I never thought about it, great advice. Thank you very much.
@massimodambrogio
@massimodambrogio 4 года назад
I really love your channel. Straight, clear and rich of good valid content.
@KevinPowell
@KevinPowell 4 года назад
Thanks!
@nikhilmwarrier7948
@nikhilmwarrier7948 3 года назад
Awesome tips! I personally would recommend instead of globally removing outline on focus, just do it on individual elements. Although it is a bit of a redundancy, keyboard users will have a way to navigate, even if you forgot to specify states for focus...
@rychei5393
@rychei5393 Год назад
Ya I like this one better.
@fivebyfivesound
@fivebyfivesound 3 года назад
I’m a beginner and wonder about best practices all the time as I’m learning, so this is very helpful. Thanks!
@rilwanadebayo4875
@rilwanadebayo4875 4 года назад
Really great advice! Good stuff!
@hcgreier6037
@hcgreier6037 3 года назад
Thank you Kevin, great tipps! In long stylesheets one doesn't see the forest for the trees, so organizing is really helpful. Sometimes classes are just not enogh, though. Because id's have the higher rank in the DOM. Especially when you need to override some styles coming from a framework, etc... This is not always achievable with classes. I think what you meant is to keep the selectors ranking as low as possible, going to higher ones only if there is no way around it? Cheers!
@felipembraga
@felipembraga 2 года назад
Kevin, i met you in this week and i'm loving! Can you say in some video whats is the better font-size to text (like blog texts)
@PeaceOutILoveMrYoung
@PeaceOutILoveMrYoung Год назад
I LOVE custom classes and ID's. I was kind of worried I was overusing them. Thanks for the reassurance.
@user-py2tg2ql4m
@user-py2tg2ql4m 4 года назад
Very great and useful tips! Thanks for that :)
@artemx100
@artemx100 4 года назад
Firefox dev tools do in fact have that contrast inspector you were showcasing in Chrome. F12 > Accessibility tab > Enable it > Click the button at the top left (while staying in the accessibility tab) and start inspecting
@KevinPowell
@KevinPowell 4 года назад
Thanks a lot, wish that was on by default!
@cheng6523
@cheng6523 3 года назад
Align focus with hover effect looks like a really useful tip 👍
@composernotes
@composernotes 3 года назад
Thanks Kevin, great help
@juliocodes
@juliocodes 4 года назад
Something that I've seen a lot that could be considered a foul is not using the short hand version of certain CSS properties. Although, I mostly see this with beginners. I've also noticed people not using a fallback font when they use a custom one.
@kencollins1186
@kencollins1186 4 года назад
One could go either way on shorthand versions. The problem is that they are hard to figure out if you haven't reviewed that part of the stylesheet in a few months. I use them sparingly.
@juliocodes
@juliocodes 4 года назад
@@kencollins1186 How so? The short hand will still be the same as the long way. The only difference is that the short hand will save you time as opposed to doing it the traditional way.
@kencollins1186
@kencollins1186 4 года назад
@@juliocodes The shorthand version only saves you time the first time you use it. Unless you are coding 8 hours a day (which I'm not), the shorthand version takes longer if it has several parameters and you have to look it up to find out what the parameters mean.
@emon123utube
@emon123utube 3 года назад
Super awesome css tips KP sir
@fabriziofilograna6498
@fabriziofilograna6498 3 года назад
Thank you Kevin, much appreciated
@amilww
@amilww 2 года назад
Amazing points! Thanks a lot
@ildarhall5086
@ildarhall5086 3 года назад
So many usefull tips for me, thanks a lot!
@CodingJourney
@CodingJourney 4 года назад
Great tips, thanks!!!
@DavidNitzscheBell
@DavidNitzscheBell 4 года назад
2:07 You said it correctly! Well done, Kevin!
@stilgharc
@stilgharc 3 года назад
Great content! Thank you so much sir.
@TransverseAudio
@TransverseAudio 4 года назад
Tip 5 is great and I haven't thought of it, same with the Chrome dev tools, I never knew it had a warning for what you mentioned after it. Thanks for the videos, Kevin. I always keep single-attribute styles to a single line without a semi-colon. is that really that bad? Would people rather see it tabbed down with a `;` even though it's the only attribute?
@KevinPowell
@KevinPowell 4 года назад
I'll do that with single ones too, specially if I have a few utility classes that are grouped together. Looks nicer, and no effect in readability. In that case 👍
@e.joaquinfloresgarcia1660
@e.joaquinfloresgarcia1660 3 года назад
Great video Kevin, one question ... when the page-content move when keyboard show it, the problem it's css ? viewport meta ? I have this issue only on Android devices
@mindcastsoftware
@mindcastsoftware 4 года назад
Oddly enough, despite working with CSS for over a decade (or maybe because of that), I do the opposite for foul #2. I actually find the compressed version to be easier to work with and sometimes even compress other people's CSS when I bring them into my projects. The primary advantage is that compressed CSS allows me to view a lot more CSS on one screen without having to scroll. For me at least, that's important, because scrolling could sometimes disrupt my ability to maintain a mental model of whatever I'm working on.
@lukerazor1
@lukerazor1 Год назад
This is the dark secret of coding standards, different people work better in different styles, having a standard only benefits the person setting the standard :)
@vukkulvar9769
@vukkulvar9769 3 года назад
Also, factor everything using SCSS ! Readability increase a lot ! Help avoiding repetition, keep things neatly together.
@nebulagaming678
@nebulagaming678 4 года назад
Awesome video as always! Could you make a tutorial on navigation bars? I am really struggling with those... But thanks for all this tips!
@kencollins1186
@kencollins1186 4 года назад
If you add navigation bars, you have to find a away to keeping them visible while not letting them cover content, and they have to reposition themselves for different aspect ratios (desktop vs mobile device).
@hugoangers8991
@hugoangers8991 3 года назад
Great video. It helps a lot, so thanks!
@janardhanangurusamy1658
@janardhanangurusamy1658 3 года назад
The last point really useful for accessibility.
@rohil3023
@rohil3023 4 года назад
Thank you for these helpful tips ;)
@gingerbeargames
@gingerbeargames 4 года назад
Appreciate the tips, I'm certainly guilty of a few of these when I'm being lazy i have noticed that especially on test projects where i'm primarily trying to learn things I put whatever i'm working on at the bottom of the stylesheet and then every hour or two I'll go through and move them into sections. Though on sub 100 line sheets I just don't see the point in the extra effort. Another thing, I hate anyone that just puts a class for everything, it really bulks up the html and makes it a pain to sift through. We should be trying to increase readability of everything rather than one thing at the expense of others.
@gizmostudios
@gizmostudios 3 года назад
Great stuff, thanks for sharing! I have a question for you though, something I'm personally struggling with and the team I'm working with.. which order would you place the rules? I've seen alphabetical order, colors first, or just fully random (usually 😂). Which approach would you recommend?
@KevinPowell
@KevinPowell 3 года назад
I order them by grouping related properties. So, all the font stuff together, all the positioning together, etc. Alphabetical is a nightmare. Takes soon much time to organize it, and also to find what you're looking for if you need to make a change. I never understood it.
@VideoHostSite
@VideoHostSite 3 года назад
SO glad to see this video!
@13aaryan
@13aaryan 4 года назад
The last point was the best. Thanks
@llejk
@llejk Год назад
About the contrast, something which needs really more attention: Bad monitor settings, especially in combination with cheap monitors. Some people like to tune up brightness and contrast. Unfortunately that can have the opposite effect on light font colors, something like #ccc on white might vanish even with good eyes.
@MontyKsycki
@MontyKsycki 4 года назад
Wow!! Great tips on using focus and the contrast ratio in Chrome! Did not know that one. One thing that frustrates me now as I get older (50) is the contrast and the typography designers use when developing forms. It looks pretty but have a hard time reading it. They always use some condensed font, it's frustrating. Great! Thanks for Helping Out and Sharing!! ~ Peace :)
@davidclark9086
@davidclark9086 2 года назад
Very informative and well made.
@divyasampath2843
@divyasampath2843 2 года назад
The focus point was useful!
@karspostema2762
@karspostema2762 Год назад
Thank you, very useful for beginners like me
@jonathanrees47
@jonathanrees47 3 года назад
You are amazing! I aspire to be a Front-End Developer of your skill level one of these days!
@mirvids5036
@mirvids5036 2 года назад
Nice to hear comments about contrast in text. Too many people think it looks stylish to have feint fonts but its crazy. It also goes against the "accessibility" ideology thats been around for years. That said, you're not getting too old yet, you still speak fast like a teenager !
@magburner
@magburner 4 года назад
I like to organise the CSS rules for each selector according to their role. This usually involves two blocks, one for positioning rules, and one for styling rules. I also like to place them in the same order, I find that this makes quick identification easier.
@KevinPowell
@KevinPowell 4 года назад
I like to group things too, though the order switches sometimes. I try to start with margin+padding, then type, then positioning if I have it, and so on. Whatever flows, but I do like keeping related properties together
@adonaielohim4147
@adonaielohim4147 3 года назад
we are learning soo much from u sir thank u soo much
@Lilliebeth001
@Lilliebeth001 4 года назад
thx again. The ToC reminds me of the Sass files in VS Code
Далее