To add icons in bootstrap 4 , include the Font Awesome reference (either locally, or use the CDN).
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
Note: If you are performing a previous / subsequent migration to the current one, perform a search and replace this "glyphicon glyphicon-"
and replace it with "fa fa-"
. Most class names CSS
of the icons are the same. However, some have changed, so you must manually fix them.
Or if you still want to use the Glyphicons icons. The glyphicons.less file of Bootstrap 3 is available at GitHub .
Then you need the following variables:
@icon-font-path: "../fonts/";
@icon-font-name: "glyphicons-halflings-regular";
@icon-font-svg-id: "glyphicons_halflingsregular";
Now I would like to convert the file .less
into a file .css
and then use it directly. The migration .less
to .css
we can make use of the following online tool less2css.org , of great utility. And so we will get the following result , save the file as glyphicons.css
and ready you can include it in your files HTML
.
<link href="/Content/glyphicons.css" rel="stylesheet" />
You also need the Glyphicon fonts that are in the Bootstrap 3 package, place them in the /% directory% co.
Now you can continue using / fonts /
in Bootstrap 4 as usual.
Current example Bootstrap version 4
.form-control-feedback {
position: absolute;
padding: 10px;
pointer-events: none;
}
.form-control {
padding-left: 30px!important;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group has-feedback">
<i class="fa fa-user form-control-feedback"></i>
<input type="text" class="form-control" placeholder="Escribe un nombre">
</div>
More migration reference in the following source.