using-bootstrap-to-create-material-design-web-apps

Difficulty:BeginnerLength:MediumLanguages:

Google’s Material Design is ubiquitous in modern mobile apps. Perhaps it’s because most people today have come to love its bold colors, subtle shadows, and minimalist layouts. Wouldn’t it be great if you could easily apply the same design language to your websites and offer visitors a user experience they’re are well accustomed to? Well, with MDBootstrap, you can.

MDBootstrap, also known as Material Design for Bootstrap 4, is an opensource UI kit that allows you to use Bootstrap 4, a CSS framework you might already be familiar with, to create fully responsive websites that have a Material Design look and feel. It comes with over 500 components, dozens of animations, and support for several JavaScript frameworks, including jQuery, Vue, and React.

In this step-by-step tutorial, I’ll show you how to add the MDBootstrap UI kit to your web projects and use some of its components.

Or, if you want to get started right away with a professional Bootstrap theme, check out some of our ready-to-go templates.

1. Setup

MDBootstrap is available on cdnjs, and several other CDNs. Therefore, you don’t need to download it to your computer to be able to use it. But adding it to a web page—along with all its dependencies—does only take a few minutes.

Start by creating a new HTML document and opening it using your favorite text editor. Then add the following HTML5 boilerplate code to it:



  
    
    My Page
  
  
  
  

The MDBootstrap UI kit consists of just two minified files: mdb.min.css and mdb.min.js. It does, however, depend on Bootstrap, jQuery, and Font Awesome to provide several features.

So, inside the head tag of the HTML5 document, add the following link tags:



Next, towards the end of the body of the document, add the following script tags:



At this point, the web page is ready to display Material Design components.

2. Creating a Header

The first component of a Material Design web page is usually a header. It acts as a container for the navigation bar, in which you can not only display your company’s logo and name, but also add links to other important pages of your website. In the Material Design spec, the navigation bar is often referred to as the top app bar.

To create a header, all you need to do is use the header tag. Creating a navigation bar, however, is a little more involved.

First, you must create a nav tag and assign the navbar class to it. This creates a basic navigation bar with a white background. If you want to give it a color from the Material palette, you can use one of the many color classes available. They have intuitive names such as purple, red, and blue-grey.

Inside the tag, you can then use the navbar-brand class while specifying your company’s name or logo.

Note that when you’re using dark colors for the navigation bar, you should add the navbar-dark class to it to ensure that the text inside is readable.

Including links to other pages of your website is as easy as creating an unordered list having the navbar-nav class, with its items having the nav-item class.

In the above code, the ml-auto class pushes the links to the opposite end of the navigation bar.

If you try looking at the web page in a browser now, you should see a header that looks like this:

A purple navigation bar

3. Using the Grid

To add actual content to the web page, you’ll want to use the responsive grid system that Bootstrap offers. For the sake of a realistic example, let’s add two cards to the page, placed in a single row having two columns.

Start by creating a div element with the container class. It will serve as a container for all the rows and columns we add to this document. Inside it you can create rows and columns using the row  and col-md classes. Because all of this is going to be the main content of the page, it’s a good idea to wrap it in a main tag.

The col-md class ensures that both the columns have the same width and fit inside the row on screens whose width is at least 768 px. To target smaller or larger screens, feel free to experiment with the col-sm and col-lg classes.

You can now create cards inside both the columns using the card class. With MDBootstrap, your cards can have images, titles, buttons, and text. Here’s the code for a sample card that has all of them:

Cherry tomatoes to get costlier

With a no-deal Brexit, you're likely to pay 10% more for cherry tomatoes next month.

More

Similarly, go ahead and add another card to the page, this time in the second column. For best results, I suggest you use images that have the same dimensions.

Raw fruits and vegetables for breakfast?

Raw fruits and vegetables that have been thinly sliced are great way to start your day.

More

As you may have noticed, the kit has intuitively-named classes, such as card-title and card-text, that help you quickly style the contents of your cards. Similarly, the btn and btn-primary classes help you give Material styles to your buttons.

With all the above changes, your web page should look like this:

Page displaying two cards

4. Creating a Form

Material Design forms have a very distinct look and feel. The design language goes into exhaustive detail about what each form element should look like, when it should be used, and where it should be placed.

MDBootstrap has styles for several HTML5 form elements. By using them, you can be sure that your forms conform to most of the guidelines of Material Design.

Let us now create a simple form your visitors can use to sign up for a newsletter. It shall have two text fields, one for a name and one for an email address. Additionally, it shall have a submit button.

The form will need its own row and column, so you must create them first. Because it’s alone, the column will stretch to fill the entire row by default. By qualifying the col-md class with a number, and by using the offset-md class, you can control the size and the position of the column in the row.

In the above code, the mt-4 and mb-4 classes give the row appropriate top and bottom margins.

Inside the column, create another card. It’ll serve as a container for the form and all the text associated with it. Optionally, you can use the card-header class to give a header to the the card, and thus the form too.

Subscribe to us

To create the form, all you need is the form tag. But you must remember to add the form-control class to each text field you add to the form. If you have a label associated with it, you must also wrap them both inside a div  element whose class is md-form. The following code shows you how:

Stay updated and get the latest information about all our offers and discounts right into your inbox.

Here’s what the form should look like now:

The completed form

Conclusion

You now know how to create simple web pages using the Material Design for Bootstrap 4 UI kit. In this introductory tutorial, you learned how to use several important components offered by the kit, such as navigation bars, cards, and form controls. You also learned the basics of positioning the components using Bootstrap 4’s grid system.

To know more about MDBootstrap, do refer to the official documentation

74 comments

  1. Pretty nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. After all I?ll be subscribing to your feed and I hope you write again very soon! .Chlebek Dukana

  2. Hi! This is my 1st comment here so I just wanted to give
    a quick shout out and tell you I truly enjoy reading
    your posts. Can you recommend any other blogs/websites/forums
    that cover the same subjects? Appreciate it!

  3. These are actually wonderful ideas in concerning blogging.
    You have touched some good things here. Any way keep up wrinting.

  4. Hi there to all, the contents existing at this site are really remarkable for people
    experience, well, keep up the good work fellows.

  5. Thanks for your marvelous posting! I actually enjoyed reading it, you could be a great author.I will make certain to bookmark
    your blog and will eventually come back sometime soon. I want to encourage you to ultimately continue your great writing,
    have a nice day!

  6. I’m now not positive where you are getting your information, but great topic.
    I must spend a while finding out much more or understanding more.
    Thank you for magnificent info I was looking for this info for
    my mission.

  7. I’m impressed, I have to admit. Rarely do I encounter a blog that’s both
    educative and entertaining, and without a doubt, you have hit the nail on the head.

    The problem is something which too few men and women are speaking intelligently about.
    I’m very happy that I stumbled across this in my hunt for something concerning this.

  8. Hi, everything is going perfectly here and ofcourse every one is sharing data, that’s really fine,
    keep up writing.

  9. Excellent post however , I was wondering if you could write a litte more on this topic?
    I’d be very thankful if you could elaborate a little bit more.

    Kudos!

  10. I absolutely love your blog and find almost all of your post’s to be exactly what I’m
    looking for. Do you offer guest writers to write content for
    you personally? I wouldn’t mind creating a post or elaborating on most of the subjects you write concerning here.

    Again, awesome weblog!

  11. Hello just wanted to give you a brief heads up and let you know a few of the images aren’t loading correctly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the same outcome.

  12. Howdy! I’m at work surfing around your blog from my new
    apple iphone! Just wanted to say I love reading through
    your blog and look forward to all your posts! Carry on the great
    work!

  13. It’s appropriate time to make some plans for the future
    and it’s time to be happy. I have read this post and if I could
    I desire to suggest you some interesting things or advice. Perhaps you could write
    next articles referring to this article. I wish to read even more things about it!

  14. Howdy, I believe your web site may be having internet browser compatibility issues.
    Whenever I take a look at your web site in Safari, it
    looks fine however, if opening in Internet Explorer, it’s got some overlapping issues.
    I just wanted to give you a quick heads up!
    Apart from that, wonderful website!

  15. Hi there, the whole thing is going sound here and ofcourse every one
    is sharing data, that’s truly fine, keep up writing.

  16. Hi, I think your website might be having browser compatibility
    issues. When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping.

    I just wanted to give you a quick heads up! Other then that,
    very good blog!

  17. We’re a bunch of volunteers and opening a new scheme in our community.
    Your web site provided us with helpful info to work on. You have done a formidable process and
    our whole neighborhood can be grateful to you.

  18. After looking at a number of the blog posts on your site, I
    seriously like your way of blogging. I book-marked it to my bookmark webpage list and will be checking back in the near future.
    Please visit my web site too and let me know your opinion.

  19. It’s very effortless to find out any topic on net as compared to books, as I found this piece
    of writing at this site.

  20. It’s actually very complicated in this full of activity life to
    listen news on TV, thus I just use internet for that reason, and take the
    most recent news.

  21. Hello there I am so happy I found your web site, I
    really found you by error, while I was searching on Bing for something else, Regardless I
    am here now and would just like to say thank you for a tremendous post and a all round
    thrilling blog (I also love the theme/design), I don’t have time
    to look over it all at the minute but I have bookmarked it and also added
    your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the superb work.

  22. Its like you read my mind! You appear to know so much about this, like you wrote the
    book in it or something. I think that you could do
    with some pics to drive the message home a bit, but other than that,
    this is great blog. A fantastic read. I will definitely be back.

  23. Excellent post. I was checking continuously this blog and I’m inspired!
    Very helpful information particularly the ultimate section :
    ) I handle such information a lot. I was looking for this certain information for a long time.
    Thanks and good luck.

  24. Hey! Someone in my Myspace group shared this site with us so I came to take a look.
    I’m definitely enjoying the information. I’m book-marking and will be tweeting this to
    my followers! Excellent blog and excellent design and style.

  25. Unquestionably believe that which you stated. Your favorite justification seemed
    to be on the web the simplest factor to have in mind of. I say to you, I definitely get irked even as folks consider worries that they plainly
    don’t know about. You managed to hit the nail upon the top
    and outlined out the entire thing with no need side effect , people can take a signal.
    Will likely be again to get more. Thanks

  26. I’m curious to find out what blog platform you have been using?
    I’m experiencing some small security problems with my latest site and I would like to find something more safe.
    Do you have any solutions?

  27. Since the admin of this site is working, no question very soon it
    will be well-known, due to its quality contents.

  28. I was recommended this blog by way of my cousin. I am not certain whether this submit
    is written by way of him as nobody else recognize such unique about my difficulty.
    You are incredible! Thank you!

  29. What’s up to all, the contents present at this web page are genuinely amazing for
    people knowledge, well, keep up the nice work fellows.

  30. I’m amazed, I have to admit. Seldom do I come across a blog that’s both equally educative
    and engaging, and let me tell you, you’ve hit the nail on the head.
    The issue is something that not enough people are speaking intelligently about.
    I’m very happy that I stumbled across this during my hunt for something relating to this.

  31. What’s Happening i’m new to this, I stumbled upon this
    I have discovered It positively helpful and it has helped me out
    loads. I’m hoping to contribute & assist different customers like its
    helped me. Great job.

  32. I really like your blog.. very nice colors & theme.
    Did you create this website yourself or did you hire someone to do it for
    you? Plz respond as I’m looking to construct my own blog and would like to
    know where u got this from. thanks

  33. I am гeally loving the theme/dеsign of yoսr web site.

    Do you ever run into aany internet bгowser compatibility issues?
    A cokuple oof mmy blog viitoгs haѵe compⅼɑіned about mу site not operating correctly in Explorer but
    looks great in Safari. Do yoս have any recommendations
    to helр fix this problem?

  34. І’m cսrious to find out whhat bllg system you happеn to be working with?

    I’m eҳperіencing some smal security ρroblemѕ wit my ⅼatestt sige and
    I would like to find something more securе. Do
    yyou have any recommendations?

    My homepage; cinta99

  35. What’s ᥙp to every one, tthe contents present ɑt this web site are actually
    remarkаble for people knowledgе, well, keep up the nice work fellows.

    Revidw my Ƅlog post: cinta99

  36. I’m prettу рleased to find this web site.

    I wanted to thank you for ones tome due to this fantastіc rеad!!I definiteⅼy appreciateԀ eѵery bit of it and I have you book marked to check out new information on your blog.

    My website; asiajoker

  37. It’s а shame yoս don’t have a donate button! I’d certainly donate to this fantastic
    blog! I guеss for now i’ll settⅼe for book-marking and
    adding your RSS feed to my Goοgle accоunt. I look forward to brand neᴡ uрdateѕ and
    wipl talk about this webvsitе witgh my Facebook group. Talk
    sοon!

    Here is my web site: Dapatkan Disini

  38. Do үou mind if I quote a couple of your articles as
    long as I provide credit аnd sоurces back to your site?

    My blog site is in the exact same area of interest as yours aand
    mʏ visitors woulɗ tгuly benefit ffrom a lot of the
    information you present here. Plezse let me know iff this oк with you.
    Aρpreciate it!

    Feel free to surf to my blog post gebyar123

  39. Heyy I know tһis iѕs off topic but I was
    wⲟndering if you knew of any widgets I could add to my blog thаt automatically tweet my
    newest twitter updates. I’ve been lookіng for a plug-in like tһis
    for quite some time and was hoping maybe you would have some experience with something liқe this.
    Pleaѕe let me know if you rսn into аnything. I truly enjoy reading
    ʏour Ƅlog and I look forwarԁ to your new updates. http://www.mhwar3.com/comment/html/?222831.html

Leave a Reply

Your email address will not be published.