I'm using antDesign with ReactJS, i need the second col to have marginTop: '30px' when…
- User
I'm using antDesign with ReactJS, i need the second col to have marginTop: '30px' when the screen size is sm or smaller. " <p style={{ color: '#5E4AE3', padding: '0' }}> زد من دخلك <Title level={1} style={{ color: '#DDDCDC', marginTop: '-10' }}>قم بالمهام البسيطة وتقاضى الأجر! <p style={{ color: '#DDDCDC' }}> كل ما عليك فعله هو تقييم الخدمات التجارية عبر الإنترنت وسندفع لك المال مقابل كل تقييم تقوم به، فقط قم بعمل حساب جديد ويمكنك البدء في تنفيذ المهام على الفور! <Button type="primary" shape="round" size="large" icon={} onClick={showModal}> سجّل الأن <img src={heroimg} alt="كريبتو تاسكي" style={{ width: "100%", maxHeight: '400px', objectFit: "cover" }} /> "
- Assistant
You can add a CSS rule to the second
Colusing media queries to apply themarginTopstyle only when the screen is sm or smaller. Here's an example:<Row justify="space-around" align="middle"> <Col xs={24} sm={24} md={12}> {/* first column content */} </Col> <Col xs={24} sm={24} md={12} style={{ marginTop: '30px' }}> <img src={heroimg} alt="كريبتو تاسكي" style={{ width: "100%", maxHeight: '400px', objectFit: "cover" }} /> </Col> </Row>And then in your CSS file, add the following rule:
@media (max-width: 576px) { /* sm screen size */ .ant-col-xs-24.ant-col-sm-24.ant-col-md-12 + .ant-col-xs-24.ant-col-sm-24.ant-col-md-12 { margin-top: 30px; } }This uses the adjacent sibling selector (
+) to target the secondColonly when it immediately follows the firstCol. It also uses theant-col-classes to target theColelement based on its size props (xs,sm,md).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.