In Blogger, How Do I Make Links Underlined Only Inside Posts - html

I see there's this tag in Blogger:
a:link {
text-decoration:none;
color: $(link.color);
}
a:visited {
text-decoration:none;
color: $(link.visited.color);
}
a:hover {
text-decoration:underline;
color: $(link.hover.color);
}
But if I change a:link to text-decoration:underline, then EVERY link in the entire blog becomes underlined which is not what I intended. I just need links inside articles/posts to be underlined. Everything else stays the same.

You can target the links inside the posts using descendant selector.
.post-body a:link {
text-decoration: underline;
}
In the above code, replace .post-body with the ID/Class of the article/post. Most probably it is .post-body by default.

Related

How to change the class to a hyperlink a href

I would like to know how to change the CSS for the a href tag.
I have been doing this in the tag directly like the following:
<a style="color: #1474c8; margin-bottom: 20px" href="#">This is link #1 </a>
This is working prefect, but I have to do several links so I consider this isn't the best way to do it. So I created a CSS class, but it's not working the same. Each time I pass the mouse over the link it behaves as a normal hyper link with the default href CSS. If I click in the link it change of color. So not sure what I'm missing
.parentCat_wChildren{
color: #1474c8;
margin-bottom: 20px
}
.parentCat_wChildren a:link{ color: #1474c8; text-decoration: none;}
.parentCat_wChildren a:visited { color: #1474c8; text-decoration: none;}
.parentCat_wChildren a:hover { color: #1474c8; text-decoration: none;}
.parentCat_wChildren a:active { color: #1474c8; text-decoration: none;}
<a class="parentCat_wChildren" href="#">This is link #2.1</a>
Adding a JSBin: https://output.jsbin.com/vutozicato
Your .parentCat_wChildren is already an a anchor so use:
.parentCat_wChildren:link {
or eventually:
a.parentCat_wChildren:link { /*make suer to also use a.parentCat_wChildren{ in this case*/
but not .parentCat_wChildren a:link {
P.S:
You can define text-decoration: none; only in one place, inside your first .parentCat_wChildren{ statement.

CSS style being applied several times

From the chrome debugger:
element.style {
}
#title a:link,a:visited,a:hover,a:active {
color: #FF33CC;
text-decoration: none;
}
(Everything below this is struck through)
nav a:link,a:visited,a:hover,a:active {
color: #000000;
text-decoration: none;
}
nav a:link,a:visited,a:hover,a:active {
color: #000000;
text-decoration: none;
}
#title a:link,a:visited,a:hover,a:active {
color: #FF33CC;
text-decoration: none;
}
#title a:link,a:visited,a:hover,a:active {
color: #FF33CC;
text-decoration: none;
}
I'm trying to figure out why an element (title) is not showing up properly. This is what it looks like in the html body:
<div id="title">
link
</div>
I understand that when it's struck through, that style isn't being applied. What I don't understand is
a) Why is the nav style being called at all?
b) Why does the title style for links get called several times? The first time it seems to work, but the second time it's being struck through? (On the website, the element currently is only showing up in black text.)
Thanks in advance!
Your style is being called because the nav parent only applies to the first part of the selector. Basically you have this:
nav a:link,
a:visited,
a:hover,
a:active{
//style
}
What you really want is:
nav a:link,
nav a:visited,
nav a:hover,
nav a:active{
//Style
}
The same thing goes for the #title a:link, a:visited, a:hover, a:active
My guess on why it is trying to use the same CSS multiple times would be that you have the same CSS in multiple places. E.G. you are either
Importing the CSS twice
Importing two CSS files with a duplicate style
Duplicating the CSS in your one CSS file
Check the associated line numbers and see if they are the same (meaning it is actually using the exact same CSS twice) or different (meaning you have the same CSS in multiple places).
you have:
#title a:link, a:visited, a:hover, a:active {
color: #FF33CC;
text-decoration: none;
}
but what it seems like you need is:
#title a:link, #title a:visited, #title a:hover, #title a:active {
color: #FF33CC;
text-decoration: none;
}
the id tag has to appear after each comma, otherwise you are styling ALL links, not just the ones with the #title id.
Hope that helps!

hover hyperlink colour not working when rolled over

I have css:
a:visited {
text-decoration: none;
color: #CCC;
}
a:hover {
text-decoration: underline;
color: #fff;
}
a:active {
text-decoration: none;
color: #CCC;
}
the hover does not work when i first load the webpage however when i click on the hyperlink then go back the hover then works. What is the issue.
Maybe there is some extra CSS hanging around somewhere... You could try resetting CSS at the beginning of your file:
a:visited, a:hover, a:active { text-decoration:none; }
Test your code at the seperate page of your project, I think it works, if it works, there is something else in your project that makes it incorrect, I mean external css

CSS a:hover not working as hoped

I'm trying to build my first site and am trying to use the "a:hover" feature in CSS but can't get it to work - the links look the same whether hovering or not.
Here's a snippet of my CSS file:
/* main page elements */
a:link
{
text-decoration: none;
color:white;
}
a:visited
{
text-decoration: none;
color:FFFFFF;
}
a:hover
{
text-decoration: none;
color:blue;
}
a:active
{
text-decoration: none;
color:blue;
}
Any help appreciated.
Thanks,
Robert.
You need to finnish the text-decoration instruction :P
text-decoration: none;
or
text-decoration: underline;
I hope you need to change the color in hover state
Try something like this one
eg.
HTML
<a href ='#'> Hover Me </a>
css
a
{
text-decoration: none;
color:#000000;
}
a:hover
{
color:#3399FF;
}
Your might be transitioning from a:active to a:hover, which has the same color. Therefore you see no difference. Try setting a unique color for a:hover, and see what happens.
It would also help if you make a jsfiddle.
Your issue is in the text-decoration: parts, if you remove them or use a valid syntax your CSS should work.

How to select text, but not images, in CSS

Simple question: I have the following markup...
<a href='#'>
<img src='icon.png'> This is the link
</a>
I want to have the text become underlined on mouseover.
What is the CSS selector for selecting only the text in that <a> element and nothing else? I'd rather not wrap it in anything if I don't have to.
a:hover {
text-decoration: none;
}
a:hover <select_text_here> {
text-decoration: underline;
}
a:hover {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a img{
text-decoration: none;
}
should do it. This way all the img tags inside a will be without any underline.
The text would have to be in its own element in order for it to be selectable in CSS. You'd have to use a span or similar:
<img src="" /><span class="link-text">Foo</span>
Obviously you can then just use .link-text to select it.
Since the text doesn't have any separate "handle" that you could select, the best you can do is underline the whole a tag, which includes the image. The image itself will not be underlined technically, so you can't even "un-underline" it.
You'll either have to separate the image from the text, or wrap the text in a span and only highlight that.
I see that Opera/IE doesn't underline the image, but FF does. The easiest way to fix it is to add span element:
<img ... /> <span>...</span>
And then apply text-decoration to span element:
a:hover span {
text-decoration: underline;
}
As far as I know you're not able to select the text only.
Perhaps try this :
a:hover {
text-decoration: underline;
}
a:hover IMG {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:hover img {
text-decoration: none;
}
another thing you could do is
a{
background: url(icon.png); background-repeat: no-repeat; padding-left: 10px
}
or similar, so you don't have to have the image element in the link