Within a table cell, I'm trying to display an image, and to its right centered vertically against the image two lines of text. The following does the centering, but the anchor tag from the first line wraps to the beginning of the next line. I've noticed this in both Chrome and IExplorer.
How do I clean up the display so that it doesn't display the leading dash on the second line?
<td>
<div>
<a href="some_other_page.html" title="Something Else">
<img class="tblimg" src="my_picture.png" style="display:inline-block; vertical-align:middle"/>
</a>
<span style="display:inline-block; vertical-align:middle">
This thing
<br>This has a leading line from the above anchor
</span>
</div>
</td>
That leading dash is actually the underline that is shown on links by default. To remove that, just apply the style: text-decoration: none; to your <a> tags.
Below is the results when I remove the default link styling:
#image-link {
text-decoration: none;
}
<td>
<div>
<a href="some_other_page.html" title="Something Else" id="image-link">
<img class="tblimg" src="my_picture.png" style="display:inline-block; vertical-align:middle"/>
</a>
<span style="display:inline-block; vertical-align:middle">
This thing
<br/>This has a leading line from the above anchor
</span>
</div>
</td>
EDIT: If you want to remove the underline for just the image, give the <a> tag that wraps around the image an ID or unique class (in my sample, I gave it an ID of image-link) and declare text-decoration: none; for that ID/class.
try box-decoration-break:none; and text-decoration:none; as well as border:none;
Add an inline:block style to the anchor containing the image, like so:
<a href="some_other_page.html" title="Something Else" style="display:inline-block">
I'm not sure why but there is this small little line connecting these buttons together. Anyone know the css to make it go away?
<div class="button">
<button> Register with <br> facebook </button>
<button> Make a new account </button>
</div> <!--end of div button-->
.button{
text-align:center;
}
Thank you very much :)
It's the default underline from the link. The line you see is actually due to the space between the end of the button and the end of the link tag.
</button> </a>
Change it to:
<div class="button"><button> Register with <br /> facebook </button>
<button> Make a new account </button>
</div>
jsFiddle example
It is caused by the default anchor tag property or text-decoration: underline;.
You can simply add a universal anchor tag style to remove it from all links like so:
a {
text-decoration: none;
}
or only to the ones in .button like so:
.button a {
text-decoration: none;
}
Finally a fiddle: Demo
Try this
<button> Register with <br> facebook </button>
I removed the space between the closing button and anchor tag
http://jsfiddle.net/4GHH4/1/
<div class="button">
<button>Register with <br> facebook</button>
<button>Make a new account</button>
</div> <!--end of div button-->
Your white spaces in your anchor tag were causing your problem. Just remove them and your problem should be solved.
I have to wrap my icon within an <a> tag for some reason.
Is there any possible way to change the color of a font-awesome icon to black?
or is it impossible as long as it wrapped within an <a> tag? Font awesome is supposed to be font not image, right?
<i class="icon-cog"></i> Edit profile
This worked for me:
.icon-cog {
color: black;
}
For versions of Font Awesome above 4.7.0, it looks this:
.fa-cog {
color: black;
}
HTML:
<i class="icon-cog blackiconcolor">
css :
.blackiconcolor {color:black;}
you can also add extra class to the button icon...
You can specify the color in the style attribute:
<i class="icon-cog" style="color:black"></i> Edit profile
Try this:
<i class="icon-cog text-red">
<i class="icon-cog text-blue">
<i class="icon-cog text-yellow">
To change the font awesome icons color for your entire project use this in your css
.fa {
color : red;
}
If you don't want to alter the CSS file, this is what works for me. In HTML, add style with color:
<i class="fa fa-cog" style="color:#fff;"></i>
Is there any possible way to change the color of a font-awesome icon to
black?
Yes, there is. See the snipped bellow
<!-- Assuming that you don't have, this needs to be in your HTML file (usually the header) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Here is what you need to use -->
Edit Profile
Font awesome is supposed to be font not image, right?
Yes, it is a font. Therefore, you are able to scale it to any size without losing quality.
To hit only cog-icons in that kind of button, you can give the button a class, and set the color for the icon only when inside the button.
HTML:
<a class="my-nice-button" href="/users/edit">
<i class="icon-cog"></i>
Edit profile
</a>
CSS:
.my-nice-button>i { color: black; }
This will make any icon that is a direct descendant of your button black.
With reference to #ClarkeyBoy answer, below code works fine, if using latest version of Font-Awesome icons or if you using fa classes
.fa.icon-white {
color: white;
}
And, then add icon-white to existing class
For me the only thing that worked is inline css + overriding
<i class="fas fa-ellipsis-v fa-2x" style="color:red !important"></i>
just give and text style whatever you want like :D
HTML:
<a href="javascript:;" class="fa fa-trash" style="color:#d9534f;">
<span style="color:black;">Text Name</span>
</a>
.fa-search{
color:#fff;
}
you write that code in css and it would change the color to white or any color you want, you specify it
You can change the Font Awesome's icon color with the bootstrap class
use
text-color
example
text-white
Sometimes changing the colour in the external css file doesn't work. You can add inline css property in the icon tag and that will work.
For example
<i class="fa-solid fa-keyboard" style="color: grey;"></i>
just give it the style whatever you want like
style="color: white;font-size: 20px;"
You can change the color of a fontawesome icon by changing its foreground color using the css color property. The following are examples:
<i class="fa fa-cog" style="color:white">
This supports svgs also
<style>
.fa-cog{
color:white;
}
</style>
<style>
.parent svg, .parent i{
color:white
}
</style>
<div class="parent">
<i class="fa fa-cog" style="color:white">
</div>
Write this code in the same line, this change the icon color:
<li class="fa fa-id-card-o" style="color:white" aria-hidden="true">
Use color property to change the color of your target element as follow :
.icon-cog { // selector of your element
color: black;
}
Or in the newest version of font-awesome , you can choose among filled or not filled icons
If you want to change the color of a specific icon, you can use something like this:
.fa-stop {
color:red;
}
It might a little bit tricky to change the color of font-awesome icons. The simpler method is to add your own class name inside the font-awesome defined classes like this:
.
And target your custom_defined__class_name in your CSS to change the color to whatever you like.
Open the svg file in vs code or something
change the line
path fill="gray" to what ever color you want! in my case i change it to gray!
I added a style, then color of your choice and make sure to make it bold
HTML:
<i class="icon-cog blackiconcolor">
css :
.blackiconcolor {color:black;}
Using class will give you a free binding property which you can apply on any tag you require.
I am using JHtml::tooltip to show my tooltips in component, but the problem is in image position. I tried to add bottom:0%, bottom:0px.
So here is what i have:
I need that image would be inline with text. Here is my code:
<div class="serch">
<div class="advanced_search">
<span id="advanced_search">Advanced Search</span>
<span>
Search:
<span id="advanced_search_by_branch"><b>By Branch</b></span> |
<span id="advanced_search_by_address">By Address</span> |
<span id="advanced_search_by_tel">By Telephone Number</span>
<?php echo JHTML::tooltip('This is a tooltip attached to text', 'Text Tooltip Title', 'tooltip.png');?>
</span>
</div>
</div>
Style included here are null. Here is also source from firebug:
You can try this
.hasTip img {vertical-align: baseline;}
You could try a simple .hasTip img { margin-top: 10px; } to move it down 10px, changing that to get it just right.
You can try inline css...
<img alt="Tooltip" src="/~nonamez/joomla/media/..../tooltip.png" style="margin-top:10px;">..
I am using the html below
<a href=""><div class="logo"><span class="whologo">hyperlinked text </span>
</div></a>
the problem i am having is that the only way to remove underline from the span text is using a:link{text-decoration:none;} but this removes underlines from ALL links from the whole page
I have tried
a.logo:link{text-decoration:none;}
but it doesnt remove the hyperlink from the span element.
You have a wrong hierarchy there and bad element selection. In your case, the most accurate CSS would be:
a div.logo span.whologo {text-decoration:none;}
But I suggest this approach:
<div class="logo"><span class="whologo">hyperlinked text </span>
And CSS:
div.logo a {text-decoration:none;}
Or include the span if needed (but only if the span element has underlines, like Hans pointed out in the comment):
div.logo a span.whologo {text-decoration:none;}
Child items cannot influence their parents using CSS. You need to put an ID or class name on your A tag, or find something unique up the tree that you can specify for this element.
Check this out
<style type="text/css">
.linkTst{text-decoration:none;}
</style>
<div class="logo"><a href="" class="linkTst"><span class="whologo">hyperlinked text </span>
</a> </div>
Put a class on your a tag where you don't want the underline
like this : http://jsfiddle.net/UL8SW/
First of all: This is not valid html... And you should give your a a class or id, otherwise this isnt possible with remote css. It is possible with inline css...
Give anchor tag a class.
HTML:
<a href="" class='no-underline'><div class="logo"><span class="whologo">hyperlinked text</span>
CSS:
.no-underline {text-decoration: none;}