If you want to take a look at my SSCCE, here is the jsFiddle link. However, I'll provide an overview of my code below. My page is created using Twitter Bootstrap 4.0:
<!DOCTYPE HTML>
<html>
<head>
<title>FooBar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<body>
<div class="container text-center mx-auto">
<div class="col-lg-12 col-sm-12 well-lg">
<img src="https://s3.amazonaws.com/smeeb-public-images/foobar.png" class="img-fluid mx-auto img-rounded" alt="FooBar logo" />
</div>
<div class="col-lg-12 col-sm-12 well-lg">
<h1 style="color: rgb(0, 170, 236); font-size: 40px;">FOOBAR</h1>
</div>
<div class="col-lg-12 col-sm-12 well-lg alert alert-danger">
<strong>Oops!</strong> Something went wrong!
</div>
<div class="col-lg-12 col-sm-12 well-lg">
<button type="button" class="btn btn-primary btn-lg">Sign In</button>
</div>
<div class="col-lg-12 col-sm-12 well-lg"> </div>
</div>
</body>
</html>
Upon reviewing the jsFiddle example, a few noticeable issues arise:
- The image appears excessively large;
- The
h1
title beneath the image seems too small; - Both the image and title lack horizontal centering on larger screens/viewports.
I aim to adjust either the bootstrap classes or CSS styles directly to achieve the following goals:
- Centrally position the image and title at all times;
- On desktop/laptop screens, the image should ideally occupy around 20% of both height and width;
- For mobile devices, the image ought to encompass most of the screen width with slight padding on each side;
- Ensure that the
h1
title dynamically resizes its text to nearly match the image's width.
Any insights on where improvements can be made?