I'm trying to hide a Carousel component when the screen is mobile only and display it in tablets or larger screens. What would be the best way? I'm using bootstrap.
Below is an edited version of my code for simplicity's sake. As you can see, this is my home page and is at the top. I want this to be hidden in the mobile version. Thanks for your help!
import React from 'react'
import { Container, Row, Col } from 'react-bootstrap';
import { HomeStyled } from './style';
import HomePageCarousel from '../Carousel';
const Home = () => {
return (
<>
**<HomePageCarousel/>**
<HomeStyled>
<Container fluid>
<Row>
<Col>
</Col>
</Row>
<Row>
</Row>
</Container>
</HomeStyled>
</>
)
}
export default Home;
Below is the CSS, where I am using styled-components..
import styled from 'styled-components';
export const HomeStyled = styled.section`
@media screen and (min-width: 320px) and (max-width: 576px) {
img,
p {
display: none;
}
}
.left-alignment {
display: flex;
flex-direction: column;
margin-top: 140px;
}
img {
height: 300px;
margin: auto;
}
.right-alignment {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: flex-end;
font-size: 1.2rem;
font-weight: 400;
margin: 0 auto;
}
.text-alignment {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: flex-end;
font-size: 1.2rem;
font-weight: 400;
margin-left: 50px;
//margin: 0 auto;
}