As a complement to Hugo's response, Bootstrap already has tools to change the display
property by varying it according to the width of the viewport (through media queries ). They are the d-*
( documentation classes).
OBS : When referring to xs
, this is screen size (
Already in the image you would use:
<img class="d-inline-block d-sm-none" src="...">
xs
causes d-inline-block
to be img
, and display: inline-block
causes it to be d-sm-none
for display: none
or larger screens, ie it will only be visible on% / p>
In this way the visibility of sm
and xs
are mutually exclusive.
Example:
html, body {
padding-top: 40px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<main class="container">
<div class="row">
<button class="btn btn-lg btn-info btn-block text-uppercase">
<span class="d-none d-sm-block">Prosseguir</span>
<img class="d-inline-block d-sm-none" src="https://getbootstrap.com.br/docs/4.1/assets/brand/bootstrap-solid.svg"style="max-width: 50px;">
</button>
</div>
</main>
You can leave the snippet in full screen (full page link) and change the width of your browser window to see responsiveness working