Once upon a time, I found myself in a situation where I needed to tackle a specific issue that could only be resolved using media query
.
As a result, I took on the challenge of creating a CSS
project that utilized media queries
to cater to different width sizes
across various resolutions, all based on Bootstrap
.
To streamline the process, I decided to generate my own stylesheet CDN Link
, which I could easily incorporate right after linking my bootstrap CDN
. This allowed me to seamlessly integrate custom classes
such as w-sm-100 w-md-50 w-lg-25
into my projects.
If you're interested, here is the link to access the stylesheet:
<link rel="stylesheet" href="https://drive.google.com/uc?export=view&id=1yTLwNiCZhIdCWolQldwq4spHQkgZDqkG">
For a live demonstration, refer to this example:
<!-- Bootstrap CDN link -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<!-- My own Stylesheet CDN Link -->
<link rel="stylesheet" href="https://drive.google.com/uc?export=view&id=1yTLwNiCZhIdCWolQldwq4spHQkgZDqkG">
<!-- HTML -->
<h1 class="w-xl-75 w-lg-100 w-md-50 w-sm-75 w-100 bg-primary">Hello World</h1>
One drawback to be mindful of is that if you specify the property w-md-50
, it will solely apply to md
and not extended to xl
or lg
.
To ensure compatibility with devices larger than md
, you'll need to structure your code like so: w-xl-50 w-lg-50 w-md-50
.