Try to use the bootstrap grid system see here, using it you don’t have to worry about the width and height of the components you are using, not to mention that your website is responsive.
If you use the grid system, avoid breaking the library logic, causing overflow of the item size by inserting the width or height selector.
If you do not know or do not want to use the grid system, I advise you to use the height and width selectors, always as a percentage.
Example: width:200%
I was recently learning to work with the bootstrap grid and maybe it’s a good show here.
This code is in Ecmascript because it was developing together with Reactjs, but ignore this detail not to complicate.
<header style={cssHeader}>
<Grid fluid={true} style={cssGrid}>
<Row style={cssRow}>
<Col lg={2} md={4} xs={12} style={cssCol}>
<h1 > Logo </h1>
</Col>
<Col lg={6} md={8} xs={6} style={cssCol}>
<h1 > Soluções Inteligentes </h1>
</Col>
<Col lg={4} md={12} xs={6} style={cssCol}>
<h1 > XXX</h1>
</Col>
</Row>
</Grid>
</header>
Note that it is possible to manipulate all elements within the grid, and it is possible to create infinite grids.
In this example of mine, I tested different sizes of the elements according to the user’s screen, so it shows the components logo
, Soluções Inteligentes
and xxx
in different ways depending on the size of the device the user is accessing, in this case the computer, tablet or mobile phone, in that order.
Want to take only this specific div or all with class
.col-md-1
?– Sam
I have 5 Divs with the class col-Md-2, on my screen the columns are very small so I used the width to increase the width, but when I expand the screen there the column gets bigger, however as I left fixed width the responsiveness does not work. so I wanted to leave width only when my screen is not expanded or minimized.
– Julio Henrique