TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: CSS design question

2 点作者 blawa大约 10 年前
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!

暂无评论

暂无评论