html - How do I make an image appear on desktops and tablets, but not on phones, using bootstrap? -
i working on small project of mine. it's website booking tours. i'm still in stages, looks like: homepage
as can see, each tour has own "div" divided in 3 columns: preview image, short description , button book tour. can add image background, if shrink page size mobile, second div appears above first 1 image in it, this: homepage mobile size
i have no idea why occurs. of have idea how make div image disappear on mobile or how solve problem? html , css code provided below, using bootstrap.
ps: ignore white-space around button.
body { margin: 0px; padding: 0px; } .jumbotron { border-radius: 0px; margin-bottom: 0px; } .options { margin-top: 30px; } .tours { padding: 0px; margin-bottom: 25px; border-radius: 5px; border: 1px solid grey; max-width: 100%; height: 20vh; } .preview-img { height: 100%; } .short-descr { padding-top: 2vh; height: 100%; background-color: red; } .more-info { height: 100%; padding: 0px; } .infobtn { height: 100%; width: 100%; }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <!doctype html> <html lang="en"> <head> <title>home</title> <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1"> <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgfzhoseeamdoygbf13fyquitwlaqgxvsngt4=" crossorigin="anonymous"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-vazp97zcwtekasvgpbsuwpfkdrwd3unufsgvyrahuqu=" crossorigin="anonymous"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script type="text/javascript" src="js/bootstrap-datepicker.js"></script> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <link rel="stylesheet" type="text/css" href="css/datepicker.css"> <link rel="stylesheet" type="text/css" href="css/homepage-style.css"> </head> <body> <!--jumbotron, header website--> <div class="jumbotron text-center"> <div class="container"> <h1>title</h1> <p>description</p> </div> </div> <!--these columns in tours displayed--> <div class="container options"> <div class="col-xs-12 tours"> <div class="col-sm-3 preview-img"> </div> <div class="col-xs-9 col-sm-7 short-descr"> <h4 class="text-left">column 1</h4> <p class="text-left">lorem ipsum dolor sit amet...</p> </div> <div class="col-xs-3 col-sm-2 more-info"> <button type="button" class="btn btn-info infobtn" href="#">more</button> </div> </div> <div class="col-xs-12 tours"> </div> <div class="col-xs-12 tours"> </div> </div> </body> </html>
add hidden-xs
class preview-img
div
Comments
Post a Comment