简体   繁体   中英

Unable to position font-awesome icons

I am using an icon from the font-awesome set. It is a bare minimum UX, where I am trying to position the icon on the right by using float . However, it does not float, and stays at its position. Even using other constructs like position = relative followed by adding values like 100px for top and left it does not alter its position.

Can anyone tell me what is it that I am doing wrong? Fiddle .

Just Target SVG Element and you will get your desire output.

svg {
  float: right;
  position: relative;
  top: 500px;
}

If you're using Font-awsome script ( SVG )(bottom of the body tag), then you should select it in CSS like this,

svg.fa-bars {
  float: right;
}

but if you're using Font-awsome link ( CSS )(inside the header tag), then you should select it like this,

i.fa-bars {
  float: right;
}

you can also try Developer tools and then you'll see that the icon is shown as <svg> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM