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: CSS design question

2 pointsby blawaabout 10 years ago
This is a followup (very specific though) to the question I asked a couple of days back: https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9162139<p>Thank you for the helpful answers there. I&#x27;m still going through the excellent links in question (and trying to lay my hands on a couple of the books mentioned) but I wonder if you guys could make suggestions for the following situation:<p>I have a block that can be used in two scenarios:<p>* list of suck blocks<p>* individual block placed among others of different kind<p>What are the best practices for deciding its margin?<p>Say the block has class `main` and a precending and a following block are respectively classed `preceding` and `following` for the second scenario.<p>If I set a margin for `main` and for the second scenario, I need `preceding` and `following` to be touching `main`, then should I set negative margin&#x27;s on preceding and following?<p>Or another solution is to set margins using immediate sibling selector `.main+.main` and not for `.main`.<p>I am sure I&#x27;m missing things, so what are the possible solutions and what are the best practices here?<p>I hope by this question, I have also managed to give a solid example of the kind of advice I was seeking in my last question. So if you guys want to re-answer my last question, i.e. resources for CSS Design Patterns, that would be great too! Thank you!

no comments

no comments