user6680 user6680 - 4 months ago 11
AngularJS Question

Using italics with font-awesome

If I remove the font-awesome tag from my text the css code font-style: italic; works ,but with this line of code {{"Andy's Bike Shop"}} for instance, italics stop working. How can I italicize text that is used in a font-awesome tag?

CSS

.header{
font-style:italic;
background-color:black;
height:60px;
color:white;
font-weight:bold;
font-size:40px;
position:relative;
padding-top:10px;
padding-left:16px;
margin-left:-10px;
margin-right:-10px;
margin-top:-10px;

}


html

<html ng-app='formApp'>
<head>
<script src="bower_components/angular/angular.js"></script>
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">

<script src="app.js"></script>
<link href="app.css" rel="stylesheet">
</head>
<body>
<div class="header">
<div class="container">
<div class='row'>
<div class='col-md-12'>




<i class="fa fa-bicycle" aria-hidden="true">{{"Andy's Bike Shop"}}</i>



</div>
</div>
</div>


</div>
<i class="fa fa-file-pdf-o" aria-hidden="true">
{{'hello'}}</i>

</body>
</html>

Answer

Add span tag inside like

<i class="fa fa-bicycle" aria-hidden="true"><span>{{"Andy's Bike Shop"}}</span></i>

The use the css as .header .fa span { font-style: italic; }

Comments