I want to flip an icon from the topbar of a website - html

I have this website: https://www.luxit.com.au/. I want to flip the phone icons from the top bar.
I inspected the page and use the class but that is not working. Then I notice that this is a sub-class, that is mentioned with i and then class and then on the last again i.
Can someone help me to find or how to write this type of class correctly in custom CSS. Thank you

Change
fa-phone
to
fa-phone-alt
in the i tag for the icons you want to flip.
e.g. instead of
<i class="fa fa-phone"></i>
change it to
<i class="fa fa-phone-alt"></i>
These are Font Awesome icons, see here https://fontawesome.com/v5.15/icons?d=gallery&p=2&q=phone

You have looked at the relevant code, one good trick is to copy it (Edit HTML and copy it in your devtools) and lay it out properly so you can see what is nested in what.
This is the code in the area you are interested in:
<span class="topbar-content">
<i class="fa fa-phone"></i>
<span>
1300 724 555 </span>
<span> | </span>
<i class="fa fa-phone"></i>
<span>
0452 611 880
</span>
<span class="mobile-clr">
<span> | </span>
</span>
<i class="fa fa-bell"></i>
<span>7am - 10pm, 7 days </span>
<span class="mobile-clr">
<span> </span>
</span>
</span>
I am not clear whether you want to get rid of the lot, in which case:
.topbar-content { visibility: hidden; }
(do this instead of display: none in case some other spacing/positioning is relying on it)
or whether you want to get rid of just one phone number in which case you could start to use nth-of-type but it depends which one you want to get rid of. Let me know if that's the case.

Related

Place text next to Facebook icon

I want to place the text Follow Us on the far right next to the facebook Icon. I added float:right to make it appear next to the Facebook Icon but it's not working for some reason.
This is my code -
Website Designed and Developed By <strong><font style="color: #00FF00"></font><font style="color: #666666"></font></strong>, Web Design Blackburn, Web Design Lancashire<span><h1 style="float:right">Follow Us</h1></span>
This is the site I am working on - http://loweraudleytyres.co.uk/dev/. Trying to edit the footer.
Screenshot of footer
Also the footer is hardcoded, so does require customisation.
#java11 I wasn't able to add an image to my comment, so I'm adding as an answer because I believe it resolves your issue as well.
Code:
<li><a href="https://en-gb.facebook.com/audleytyres/">
<i class="fa fa-facebook"> FOLLOW US </i></a>
</li>
Put your logo and your text in a a tag (link) with the style float:right; & add display:inline;
Example :
<a href="#" style="float:right;">
<i class="fa fa-facebook" style="float:left;"></i>
<span style="display:inline; margin-left:5px;">FOLLOW US</span>
</a>

Inline css for modern days?

I have a html webpage containing with lot of css. Let's say if I have one style per div, do I need to add it to my external css file or just write internal css inside of that html page?
Take a look at this example.
<div class="sub">
Link <i class="fa fa-user-circle-o" aria-hidden="true"></i>
</div>
I need to add two different colors to "link" and icons. I can simply do this way.
<div class="sub">
<a href="#"> <span style="color:red"> Link </span>
<i class="fa fa-user-circle-o" aria-hidden="true" style="color:black"></i></a></div>
Or can add classes and write it to external css also.
<div class="sub">
<a href="#"> <span class="color-1"> Link </span>
<i class="fa fa-user-circle-o" aria-hidden="true" class="color-2"></i></a>
</div>
I know those two methods are working but need to know the best practice for this type of situation. Internal or external?
In a short answer:
As far as possible don't use inline style, because inline style has Highest priority after !important keyword.when we have too many lines and use of inline style, it is very hard if we want to find and overlay it.
Actually it's a good practice to have your CSS in external, but it depends upon the situation. For this, it is best to use inline CSS.

Website links behaving abnormally

I have made this website: http://manojpandey.tk/ implementing Bootstrap v.3
In the Contact section, I have added some social buttons.
<ul class="list-inline banner-social-buttons">
<li>
<i class="fa fa-twitter fa-fw"></i> <span class="network-name">Twitter</span>
</li>
<li>
<i class="fa fa-facebook fa-fw"></i> <span class="network-name">Facebook</span>
</li>
</ul>
They are showing some abnormal behaviour that I don't get. When someone clicks on the button directly, a blank webpage with same url opens. Opening in new tab does good.
But, why does the former does not work. Any help will be appreciated.
<a class="btn btn-default btn-lg" href="http://twitter.com/manojpandey96" target="_top"><i class="fa fa-twitter fa-fw"></i> <span class="network-name">Twitter</span></a>
Works for me. So just add:
target="_top"
to the a-Tags.
Is there a reason why you are using frames?
Edit:
The Frames are causing the problem. Without adding target, the link usually will open within the frame. But if you add target="_top", then it will be loaded in the full window, ignoring the frames.
More detailed explanation here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

How do I make Font Awesome WCAG 2.0 compatible?

If I have a site with a couple of font awesome icons on it, e.g.
<i class="fa fa-fw fa-cloud "></i>
And run this through the WCAG 2.0 validator I get the following error:
Success Criteria 1.4.4 Resize text (AA)
Check 117: i (italic) element used.
Repair: Replace your i elements with em or strong.
Error Line 185, Column 158:
<i class="fa fa-fw fa-cloud"></i>
I realize that the rule shouldn't really apply in this case, as it is there to ensure that <em> and <strong> are used instead of their non-semantic counterparts <i> and <b>. But the problem still exists if I have a client that requires me to check all the WCAG2.0 boxes.
So does anyone know what would be the proper way. Should I change them to <em> instead, does that give screen-readers any difficulties? Any other suggestions are welcome!
First, <i> does have semantic meaning in HTML5 (but was only presentational before that). Assuming you're using HTML5, the validator you're using is wrong to flag all occurrences of <i> as inappropriate.
Second, changing
<i class="fa fa-fw fa-cloud"></i>
to
<span class="fa fa-fw fa-cloud"></span>
is good but it doesn't fix the real accessibility issue, which is that you don't have any text alternative to the icon (at least it appears that you don't). For the sake of argument, let's assume your fa-cloud icon is inside an <a> tag. Something like this (using Bootstrap's sr-only CSS class):
<a href="...">
<span class="fa fa-fw fa-cloud" aria-hidden="true"></span>
<span class="sr-only">Download</span>
</a>
or like this (using WAI-ARIA's aria-label attribute):
<a href="..." aria-label="Download">
<span class="fa fa-fw fa-cloud" aria-hidden="true"></span>
</a>
is the solution. Even simpler would be to show the text to everyone:
<a href="...">
<span class="fa fa-fw fa-cloud" aria-hidden="true"></span>
Download
</a>
from font-awesome doc:
You can place Font Awesome icons just about anywhere using the CSS Prefix fa and the icon's name. Font Awesome is designed to be used with inline elements (we like the 'i' tag for brevity, but using a 'span' is more semantically correct).
So, you could try changing your 'i' tags for 'span'.
It very much depends on what the content is inside the i tag is semantically. WCAG2.0 is a set of guidelines, not hard and fast rules.
According to the HTML5 spec:
The i element represents a span of text in an alternate voice or mood,
or otherwise offset from the normal prose in a manner indicating a
different quality of text, such as a taxonomic designation, a
technical term, an idiomatic phrase from another language,
transliteration, a thought, or a ship name in Western texts.
From: http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#the-i-element
If the content is something that needs to be "emphasises" then, no use the em tag as that is semantically correct across all user agents. The example on the spec, with a Latin technical name for an animal, is a perfect example of something that would be italicized, but not emphasised (although visually they would look the same).
<p>The <i class="taxonomy">Felis silvestris catus</i> is cute.</p>
Would be styled:
The Felis silvestris catus is cute.
So, if you can justify why the text is "italic", but not emphasised, keep it as is, otherwise change it to a semantically appropriate tag.
Adding to danielnixon answer (+1): if I want to use a fontawesome icon as a decorative thing in the UI (not a link, button, etc), I add a span with a wai-aria attribute:
<span class="fa fa-small-arrow" role="presentation"></span>

How do you markup a 5-star product rating with FontAwesome using microdata?

According to Google there are a few ways to mark up a 5 star rating to get it pulled through into search results.
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=172705
None of these cater for using an icon-font such as FontAwesome.
The star rating does not need to be interactive.
Currently the code we have is:
<div class="rating">
<meta itemprop="rating" content="4.5" />
<i class="icon-star"></i>
<i class="icon-star"></i>
<i class="icon-star"></i>
<i class="icon-star"></i>
<i class="icon-star-half"></i>
<span class="visually-hidden" >4.5 stars</span>
</div>
The span is hidden from displays but is still accessible to screen-readers.
Is the addition of the <meta> tag necessary or even valid?
Google suggests this:
By including <meta itemprop="rating" content="4.5" /> inside the HTML
block that causes the stars to be displayed, you indicate that the
rich snippets parser should use the value in the content attribute to
find the rating.
and has the following example:
<span class="rating-foreground" style="width:90%">
<meta itemprop="rating" content="4.5" />
</span>
As I understand it the itemprop="rating" can be added to any element so can just move that onto your div.
Using the aggregate rating item properties from schema.org, the best option we have so far is the following:
<div class="rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<i class="icon-star"></i>
<i class="icon-star"></i>
<i class="icon-star"></i>
<i class="icon-star"></i>
<i class="icon-star-half"></i>
<span class="visually-hidden"><span itemprop="ratingValue">4.5</span>/5</span>
</div>
Removing the <meta> tag but adding and separating out the rating value from the total.
You must include itemprop="votes" to google display rating stars in search result
example:
<span class="visually-hidden">
<span itemprop="ratingValue">4.5</span>/5
<span itemprop="votes">10</span>
</span>