Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Font Awesome icon after <hr> using CSS

I'm looking to style a Horizontal Rule with CSS. I've done this so far:

http://tinkerbin.com/vdzgAZ9q

However, I want to use the 'icon-star' from Font Awesome instead of the § symbol.

Could someone tell me how this would be done?

Thanks!

like image 221
Raghav Kanwal Avatar asked Mar 09 '13 12:03

Raghav Kanwal


People also ask

How do I use Font Awesome icons after CSS?

To use font awesome icons as CSS content code follow the below steps. Add a unique CSS class name to the icon element you want to use. Set the font-weight css property as 900 (For Solid), 400 (Regular or Brands), 300 (Light for pro icons). Set the content css property to the unicode value font awesome icon.

How do I add Font Awesome icon inside input field?

It is as simple as putting Font Awesome icon on any button. The <i> tag and <span> tag are used widely to add icons on the webpages. To add any icons on the webpages, it needs the font-awesome link inside the head section. The font-awesome icon can be placed by using the fa prefix before the icon's name.

How do you add icons before CSS?

The CSS3 pseudo-element ::before will place the icon before the link text. In this example, the ID selector for the menu's home link is #menu-link-1 which you can see by right-clicking the link and choosing Inspect in the browser menu. You can also use the ::after pseudo-element to place an icon after the link text.


1 Answers

First step is download fonts from fortawesome
Second include them in to css. Be careful with the paths to the font files:

@font-face {
  font-family: 'FontAwesome';
  src: url('../font/fontawesome-webfont.eot?v=3.0.1');
  src: url('../font/fontawesome-webfont.eot?#iefix&v=3.0.1') format('embedded-opentype'),
    url('../font/fontawesome-webfont.woff?v=3.0.1') format('woff'),
    url('../font/fontawesome-webfont.ttf?v=3.0.1') format('truetype');
  font-weight: normal;
  font-style: normal;
}

And at last, replace content rule for hr selectior from "§" to "\f005"

hr:after { content: "\f005";}
like image 111
ErDmKo Avatar answered Sep 24 '22 13:09

ErDmKo