TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do I get better at CSS?

42 pointsby Catalyst4NaNalmost 10 years ago
Most of the courses I&#x27;ve looked at for learning css are either too theoretical or aimed at beginners.<p>I feel as though I have a decent theoretical understanding of CSS but I want something that is just drilling home stuff like creating great looking buttons, panels and input fields.<p>Any suggestions are much appreciated!

16 comments

acemarkealmost 10 years ago
I&#x27;m an applications programmer. My first meaningful web dev experience was a GWT app I built from 2011-2012 using the SmartGWT widget library. They completely bypass the standard CSS layout modes - everything is absolutely positioned using locations calculated in JS. Felt very much at home given my previous desktop UI toolkit experience.<p>However, for the last two years I&#x27;ve been building a related web app that&#x27;s all JS. We&#x27;ve cobbled together our own UI conventions out of HTML, CSS, and Backbone&#x2F;Marionette classes. For a long time, I got frustrated with any task that involved doing UI layout. I inevitably found myself reduced to desperate googling and randomly flipping CSS attributes in the hopes that I might finally get things to slide into place.<p>Fortunately, in the last couple months things seem to have finally come together for me. The two keys for me have been:<p>- Grasping the core concepts of the HTML box model and block&#x2F;inline behavior<p>- Flexbox. Flexbox FTW. I&#x27;ve been able to replace SO many nasty CSS hacks with simple flexbox directives over the last few weeks.<p>Here&#x27;s two key links that have really helped me:<p>- <a href="http:&#x2F;&#x2F;learnlayout.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;learnlayout.com&#x2F;</a> is a great guide to the basics of layout in CSS<p>- <a href="http:&#x2F;&#x2F;jonibologna.com&#x2F;flexbox-cheatsheet&#x2F;" rel="nofollow">http:&#x2F;&#x2F;jonibologna.com&#x2F;flexbox-cheatsheet&#x2F;</a> is a simple graphical overview of flexbox commands<p>Obviously, all this is focused on the layout aspect rather than the &quot;styling&quot; part per se, as that&#x27;s been my biggest concern on this project.
评论 #9634630 未加载
err4ntalmost 10 years ago
STOP copying and pasting. Try typing every character in your CSS and never rely on external or pre-made libraries and you will learn what is, and more importantly what is not actually required for a layout to work.<p>In two years of adopting this policy in my own work I would say I learned as fact as the entire decade before that, where I was making quilts by stitching pre-made bits of fabric into one larger piece.<p>Don&#x27;t be a quiltmaker any longer!
评论 #9635492 未加载
compbioalmost 10 years ago
- Design an application or website inside the browser (no photoshop mockup).<p>- Find and read some front-end designer blogs.<p>- Take a good (CSS) framework like HTML5 boilerplate and dissect its code.<p>- Remake your last favorite designed site without looking at their code. Then compare afterwards.<p>- Start creating your own framework for rapid prototyping. Add layout-rules to common UI elements: breadcrumbs, pane lists, buttons, forms etc.
评论 #9635144 未加载
corywatiloalmost 10 years ago
If you know the basics, I&#x27;d say the best way is to actually build out some pages with different components and layouts. It&#x27;s easy to code up one page, but when you get to having to build out multiple pages with different elements, it really makes you step back and start to componentize your CSS and make you think modularly. Nothing will beat experience and familiarizing yourself with different scenarios. When I was starting out, I went this route and utilized Experts Exchange when I got stuck. Great community over there (or at least 10ish years ago...)<p>If you&#x27;re not a designer, take a popular webpage and build your own version of it, then look at the real source code and see how yours compares, or ask some CSS forum members to look over your code.<p>Build a library of frequently used styles. I have something like the following:<p>.small {font-size: 12px;} .big {font-size: 16px;} .bigger {font-size: 18px;} .biggest {font-size: 20px;}<p>...and it extends from everything like font sizes to colors.<p>.red {color: #f00;}<p>Then when you&#x27;re building something out, you can reference generic styles from your own library. It makes things quick:<p>&lt;p class=&quot;big red&quot;&gt;foo&lt;&#x2F;p&gt;<p>I&#x27;d recommend against using something like Bootstrap early on. To really get the grasp of CSS, you&#x27;ll want to work with ONLY your own code so you really understand how it works. Libraries are great, but you can only fully understand it if you control everything.<p>Hope these tips help!
realrockeralmost 10 years ago
As a low level android middleware guy with little knowledge of css in practice, I found this guide: <a href="http:&#x2F;&#x2F;www.basscss.com&#x2F;docs&#x2F;guides&#x2F;basics&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.basscss.com&#x2F;docs&#x2F;guides&#x2F;basics&#x2F;</a> very effective. Especially the recommended order of css commands made a lot of sense to me: <a href="http:&#x2F;&#x2F;www.basscss.com&#x2F;docs&#x2F;guides&#x2F;basics&#x2F;#order" rel="nofollow">http:&#x2F;&#x2F;www.basscss.com&#x2F;docs&#x2F;guides&#x2F;basics&#x2F;#order</a> .
TheLemalmost 10 years ago
In my opinion it goes like this :<p>- Make a sketch of the design, form positioning or interface you want for a certain page.<p>- Try to translate this design to a more comprehensible form for your interpreter (I mean writing CSS lines).<p>- Long cycle of try and error, reading stackoverflow, testing, reading snippets.<p>Practice this for a certain amount of time (be patient!) you will find yourself a world class CSS &quot;writer&quot;. The main basis is moving from a sketch to CSS script.
评论 #9634548 未加载
评论 #9634543 未加载
DanBCalmost 10 years ago
Teach other people - it&#x27;s a great way to discover how solidly you understand something and where gaps in your knowledge are.
评论 #9634675 未加载
dominotwalmost 10 years ago
1. Follow right people on twitter eg,<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;SaraSoueidan" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;SaraSoueidan</a> <a href="https:&#x2F;&#x2F;twitter.com&#x2F;anatudor" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;anatudor</a> <a href="https:&#x2F;&#x2F;twitter.com&#x2F;LeaVerou" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;LeaVerou</a><p>2. Get a codepen account and start experimenting, sharing new ideas on css forums ect.<p>3. Try to replicate some css frameworks like pure. Read the code; try to figure out how they did something.<p>4. Finally, I recommend CSS Secrets book by Lea Verou. You can buy a pre release copy.
janpieterzalmost 10 years ago
In my experience the best way to learn these kind of things is just to try!<p>You might have a list with ideas (they can even be stupid, or already existing). If not, try to make one, the craziest things can go on there. Then every week try to sit down and make the user interface for them. Look at other websites that offer familiar services and combine them. Learning while practicing putting your ideas into reality has been my best way of getting any real sustained progress in skills!
评论 #9634731 未加载
thekevanalmost 10 years ago
One thing I found really useful was taking things others have built and modifying them. Think about the offline world, sometimes the best way to learn how to build something is taking apart and putting back together something someone else already built.<p>There&#x27;s a bunch of different ways to do this, one I liked was downloading free Bootstrap themes and making them look different. An unexpected bonus was learning to find errors in the code.
Sakesalmost 10 years ago
It sounds like you are more interested in design than the implementation of it.<p>For great looking buttons&#x2F;fields you just need to be sensitive to font selection, padding, borders, &amp; colors.<p>1) Refer to apps &#x2F; sites that you think are beautiful<p>2) Dissect them for:<p>- Color palettes<p>- horizontal padding<p>- vertical padding<p>- margins sizes<p>- border thicknesses<p>- font stacks<p>- font sizes<p>3) always build on top of a css framework such as bootstrap<p>4) implement design tweaks referring to your notes of other apps you wish to imitate.
评论 #9634938 未加载
Nokrosisalmost 10 years ago
I can give you this suggestions:<p>1. Start making PSD to HTML&#x2F;CSS with the following rules: - Write as less HTML as you can and use CSS to get the style. - Avoid using images as hard as you can. - Always remember we want a fast Web and every byte counts.<p>2. Be curious, if you see something you like on a website, check their code, look how they did it and try experiment with it. Try to find a cleaner, better and less-code way to do it (if ther is) and apply it to your projects.
edoceoalmost 10 years ago
Ive got a bunch of stuff that needs design. You can practice on 10+ sites with unique design needs. Public work for your portfolio. I will pay you.
fskalmost 10 years ago
Find a page with a CSS problem (even bonus points if it&#x27;s for work). Then, use a web debugger to identify and fix the problem (Firebug or Chrome).<p>As someone else said, write your own responsive grid from scratch. Try writing a responsive contact form (name, E-Mail, message body).
apricot13almost 10 years ago
Go to dribbble and replicate certain components you find there. Set yourself a condition for each one you do.<p>* Modern browsers only * use flexbox * must work in ie6 with no js * must degrade gracefully etc
marcusmolchanyalmost 10 years ago
Hey I was in the same place as you about a year ago and these are a few of the things I did to practice:<p>Pick a CSS framework and look through the source. Bootstrap is a great one (<a href="https:&#x2F;&#x2F;github.com&#x2F;twbs&#x2F;bootstrap&#x2F;blob&#x2F;master&#x2F;dist&#x2F;css&#x2F;bootstrap.css" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twbs&#x2F;bootstrap&#x2F;blob&#x2F;master&#x2F;dist&#x2F;css&#x2F;boots...</a>). You can read through their documentation and find the styles in the source to see how it works (<a href="http:&#x2F;&#x2F;getbootstrap.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;getbootstrap.com&#x2F;</a>).<p>Whenever you see something cool on a website, Right Click -&gt; Inspect Element and figure out how they did it. Google Chrome developer tools are really awesome for this. You can toggle existing styles, add styles, edit html, etc (<a href="https:&#x2F;&#x2F;developer.chrome.com&#x2F;devtools&#x2F;docs&#x2F;elements-styles" rel="nofollow">https:&#x2F;&#x2F;developer.chrome.com&#x2F;devtools&#x2F;docs&#x2F;elements-styles</a>)<p>For detailed explanations use Mozilla Developer Network (<a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS</a>). They have very comprehensive write ups for every style attribute.<p>CSS Tricks has great write ups for specific styles and sets of styles to achieve things like centering, layout, and pretty much everything else you can think of (<a href="https:&#x2F;&#x2F;css-tricks.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;css-tricks.com&#x2F;</a>)<p>The Codrops CSS Reference is also very, very detailed (<a href="http:&#x2F;&#x2F;tympanus.net&#x2F;codrops&#x2F;css_reference&#x2F;" rel="nofollow">http:&#x2F;&#x2F;tympanus.net&#x2F;codrops&#x2F;css_reference&#x2F;</a>)<p>Like many other people have said, if you think up a design you can use jsfiddle, jsbin, coderpen or any in browser editor to quickly try and style something up.<p>For larger CSS code bases you&#x27;ll need to keep things readable and easily understandable for yourself and others. My team follows the Medium CSS&#x2F;LESS Style Guide. It&#x27;s a really excellent way to keep your code organized when you start working in larger code bases. <a href="https:&#x2F;&#x2F;medium.com&#x2F;@fat&#x2F;mediums-css-is-actually-pretty-fucking-good-b8e2a6c78b06" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@fat&#x2F;mediums-css-is-actually-pretty-fucki...</a><p>Good luck!<p><i></i>Edit<i></i> I forgot to mention reading up on media queries. Media queries are extremely important for when you get into responsive design and dealing with content layout across all sorts of different screen sizes. Google has a very good write up on this (<a href="https:&#x2F;&#x2F;developers.google.com&#x2F;web&#x2F;fundamentals&#x2F;layouts&#x2F;rwd-fundamentals&#x2F;use-media-queries?hl=en" rel="nofollow">https:&#x2F;&#x2F;developers.google.com&#x2F;web&#x2F;fundamentals&#x2F;layouts&#x2F;rwd-f...</a>) as well as CSS Tricks (<a href="https:&#x2F;&#x2F;css-tricks.com&#x2F;snippets&#x2F;css&#x2F;media-queries-for-standard-devices&#x2F;" rel="nofollow">https:&#x2F;&#x2F;css-tricks.com&#x2F;snippets&#x2F;css&#x2F;media-queries-for-standa...</a>)