TIPS & ADVICE
CompuWizards is full of incredible features but can seem too complex for many of us. You simply cannot remember all the functions or cannot take one week off to study its documentation. Many times even experienced users get surprised when they discover some of its hidden gems.
I have carefully chosen some of the best tips and tricks that I have used in my CompuWizards coding career so far and I would like to share them with you.
For a better reading experience, I divided them into 4 groups.
If you would have suggestions for some more tricks, share them with me in comments.
- How to make columns same height
- How to add vertical spacing to columns
- How to use your own classes instead of columns and rows
- How to change ordering of columns on mobile
- How to show or hide elements on mobile
- How to disable responsiveness
CompuWizards User / Pro
- How to open a navbar dropdown on hover
- How to change navbar height
- How to create sticky footer
- How to center an inline content
- How to use heading classes
- How to responsively embed YouTube or Vimeo videos
- How to create custom Bootstrap buttons
- How to disable buttons and other form elements
How to make columns same height
This is a classical problem. You have content boxes with different content but you want them to have the same height. A solution to this problem will be a smart usage of flexbox on the Bootstrap rows.
To add some vertical spacing to your columns easily, use the following simple CSS rule that gives bottom margin of 30px to every Bootstrap column.
A quite useful feature of the Bootstrap grid is an ability to order columns differently on mobile devices and differently on desktops.
All you need to do is to use .col-(breakpoint)-push-(number) and .col-(breakpoint)-pull-(number) classes to push or pull the columns on the specified breakpoint out of its original place.
I know it sounds a bit complicated and usually, it takes me some time to visualise the outcome but let's have a look at it in an example. In the following code, the first column will appear as a first item on mobiles but as a second item on tablets and desktops.
In the following code, the first column will appear as a first item on mobiles but as a second item on tablets and
How to make columns same height
The standard behaviour of Bootstrap dropdowns is that they open on click. It has its pros and cons and I usually keep it as default. If you would like to open dropdowns on hover, it is not a complicated process to achieve it.
We will need to change two things and we will apply our changes only if the viewport's wider than 768px (i.e. navbar is not collapsed).
First, add this CSS rule to your stylesheet after loading the Bootstrap's CSS. It is quite straightforward - if the viewport's wider than 768px and you hover above a .dropdown link, a .dropdown-menu opens.
How to open a navbar dropdown on hover
In tips before, you can make your row element’s children in the center of the screen. But how about if I was going to place some text or image in a column (col class)? Doesn’t the class I mentioned before is only useful when applied into class row? You can do actually to make your column’s content center, by combining the col class with the text-center. This combination is a bit tricky that the images (or other elements) inside them (the columns) must have inline-block display to make this tips works. Sometimes I found this tips working, and sometimes I don’t. It’s just a matter of time and a little tweaks that this tips is actually works somehow. It may looks like this.
How to change navbar height
Bootstrap library for CSS as they mentioned themselves, is a mobile-first responsive library to make your projects easier and faster to develop. This means that they have prepared some styling to make your web page beautiful and responsive in mobile-view. Yes, mobile-view, the times you access or see your web pages in tablet or mobile screen. They provide a mechanism to make your web page beautiful yet still responsive when accessing via mobile screens. You can make your web pages like that by applying different class col to fit the screen size.
How to create custom Bootstrap buttons
This tips is the next step from the point above. This is related in the way that how you define the media queries in your CSS.
As far as I know, the smaller screen size that you want to apply the style into, the latter you must be define in your CSS file. Take an example. Imagine you want to make a box with width of 720px size in the laptop screen, but you want to have them having width of 50% of your screen size when you see in tablet screen, and having width of 100% when you see in mobile screen. You could solve this problem simply by applying rules like below (just for example).
How to disable buttons and other form elements
Bootstrap exists to make the developer’s life easier, especially when it's come to build we pages. Bootstrap is defining some screen resolution groups, and they are xs, sm, md, lg, and xl screens. The xs screen is the default when it comes to choose what kind of col class is match for you. The next bigger of class col is sm up until the largest is xl screens. The xs class comes with max-width of 575px, the sm class comes with min-width 576px and max-width 767px, the md class has min-width 768px and max-width 991px, the lg class has range 992px until 1199px, and the biggest is xl class with having only min-width of 1200px.
When you’re building your own web pages, make sure you test them with the all resolution I just mentioned above. This, to make sure that your web pages is truly like what you expect from your code. You can use tips I just mentioned above about combining different col class to meet your needs.