Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use bootstrap in laravel mail template

I am tried more then 20 times to getting button with href using bootstrap in mail tamplate but it not give right output.

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<a href="http://google.com" class="btn btn-success">Yes</a> 
like image 302
dhamo dharan Avatar asked Feb 25 '16 13:02

dhamo dharan


People also ask

Can I use bootstrap with Laravel?

Introduction. While Laravel does not dictate which JavaScript or CSS pre-processors you use, it does provide a basic starting point using Bootstrap, React, and / or Vue that will be helpful for many applications.

Can Bootstrap be used with emails?

No. Bootstrap is a pre-defined framework containing properties for elements and classes which is used using external css entirely (with the properties for elements and classes being defined in an external file). Since external css can't be used to style e-mails, Bootstrap can't be used either.


2 Answers

Unfortunately, it appears that Gmail does not support link or style tags ANYWHERE in the HTML. This is getting seriously annoying

like image 55
M Zishan Avatar answered Sep 21 '22 21:09

M Zishan


You can't use the link tag in most of the emails. Because not many email clients support this, best to just forget it. I guess you need to put the CSS in there raw. Example:

<style>
    // All the bootstrap css
</style>

But I recommend (if you want to do it your own way) to style your own button, this way there will be less data in your email template.

<button type="button" style="background-color: red;">My button</button>

EDIT

Best to use an email css/framework template, check this question

like image 43
Dees Oomens Avatar answered Sep 24 '22 21:09

Dees Oomens