Bootstrap Best Practices for PSD to Bootstrap Conversionby Danial Smith HTMLPLUSCSS
Bootstrap offers incredible features although some of them seem difficult to use for a beginner or novice users. However, coding in Bootstrap is relatively simpler than other tools. In respect to complex features, it is true that you cannot study the whole documentation in a week or so, to remember all its functionality. Many time this framework even wonders to experienced designers when they find some hidden gems of it. We are going to list down some best tricks of Bootstrap for PSD to HTML Bootstrap conversion that I have experienced in years of coding career. Here is the list for you:
Navbar and Footer Components
• Opening drop-down on hover
The drop-down using Bootstrap standard is that it opens with just a click. However, it has some merits and demerits, hence I often prefer to use it with no amendments. Creating drop-down which gets open on hover is not really complex to achieve via Bootstrap.
To attain it, you need to follow the following:
Make changes in CSS only when the viewport exceeds 768px. Apply this rule in your stylesheet once the Bootstrap’s default CSS completes loading. If you find viewport larger than 768px, simply hover .dropdown link which opens .dropdown-menu.
In case the parent link points to a path or URL, add JavaSript code in order to revise the on-click behavior of the .dropdown link.
To modify the navigation bar height, you need to do more than simply including different height value which is done for .navbar. Refer the below-outlined CSS code to make changes to the navbar’s height. Here we have changed height from default to 80px.
• Creating sticky footer
If you would like to have a sticky footer on your website, have a glance at the steps listed below:
Create a fresh footer element then make sure that the position of this element is set to absolute containing bottom offset as 0. You need to keep height fixed for the footer element as you can see the height is fixed at 80px in the code below:
In the <body> element of your Bootstrap code, add a bottom padding and its value must be set same as mentioned for the footer’s height.
Layout and Typography Tricks
• Center the inline content
Using Bootstrap it is an easy process to center the inline-block element as well as inline content within a div file. To center the inline text successfully, add a class .text-center to the parent element as shown in the HTML code below.
In this example (HTML code), we are going to centre the button and text horizontally:
To center the block element horizontally, add a class center-block like this:
This class will automatically include a CSS style in your block element:
• Embedding video with responsiveness
Bootstrap provides a helper class embed-responsive to simplify the process of embedding any video either a YouTube Video or a Vimeo video. Only you need to select one option between embed-responsive-4by3 or embed-responsive-16by9 depending on video ration.
Have you got stuck ever in the code when your heading seems very small however it is set to h2. If you are facing the same while creating code in Bootstrap, then the smart move it to add .h4 to the .h2 and see the visual appearance. Indeed, you will get the result of your choice. Refer the HTML as shown below:
Bootstrap Forms and Buttons
• Creating custom button
The Twitter’s Bootstrap framework comes with 5 default styles for buttons; primary, danger, default, success, and so on. To change the behavior of a simple button like by decreasing padding or border radius, override the .btn class. This is one of the simplest ways of changing button behavior.
Yet another way I would like to suggest for the same is to design a button type. Once created, then you need to extend the Bootstrap’s common button style.
Here are the steps to create a custom outline button:
First of all, create a new class named as .btn-outline then expand the default Bootstrap’s button styling.
Style the default states along with .active, :active, :hover, and :focus.
Once the above steps are done, you will get a fresh button created which is on your tap.
• Disabling buttons
To disable buttons in Bootstrap, you need to perform any of the following steps in the HTML code:
Include .disable class within <a> button
Or, include disabled as an attribute under <button> attribute
Now that you know the smart tips and tricks you should use while using Bootstrap for any of your projects built with design to Bootstrap conversion. If you don’t have hands-down experience in Bootstrap, then avail services from a professional PSD to Bootstrap conversion company. Or, you can hire a dedicated Bootstrap developer to get your project done. Depending on requirements you can choose between PSD to HTML Bootstrap conversion services from a leading front-end company or a dedicated cum experienced Bootstrap developer to your website development.
If you would like to say anything about these tricks or suggest an important Bootstrap tip which is not mentioned in this post, let us know. We look forward to hearing it from you.
Read more at: Htmlpluscss Blog
Created on May 21st 2018 03:46. Viewed 333 times.
No comment, be the first to comment.