I was wondering if you could display a link as normal text.
<a id="" href="" target="_parent"><img src="" width="121" height="20" alt="">
<div style="position:absolute;left:163px;top:1px;font-size: 12px; display: block">
<font color="white">Log in</font></a>
I'm trying to overlap an image that is also a button, with the text "Log in", it works as it is with the code above, but I was wondering if I can change the "log in" which displays as blue and underlined to appear as normal text.
In css:
a {
color: inherit;
text-decoration: inherit;
}
These values can also be stuck in your anchor tag's style attribute.
Should result in your anchor tags looking the same as the text color and decoration of the parent(s).
If you have a look at Cascading Style Sheets (CSS) you can change the colour and the text style of the link.
In your example, you could use
<a id="" href="" target="_parent" style="color: white; text-decoration: none;"><img src="" width="121" height="20" alt="">
<div style="position:absolute; sleft:163px;top:1px;font-size: 12px; display: block">
<font color="white">Log in</font>
</div>
</a>
However I would learn how to use external stylesheets and link them to your HTML through the <link> tag in the <head> of your html. You can then style up individual tags through the tag name, an id or a css class. So an updated example would be:
<link rel="stylesheet" href="link-to-your-css-file" />
in your css file have
a.imgLink{
color: white; text-decoration: none;
}
div.imgLink{
position: absolute; left: 163px; top: 1px; font-size: 12px; display: block;
}
Then your html would be
<a class="imgLink" id="" href="" target="_parent">
<img src="" width="121" height="20" alt="">
<div class="imgLink">
Log In
</div>
</a>
Not only does it make your HTML "dry" but it gives you greater control over the styles of your html by only changing the css file.
If you don't want the link to be underlined,
set " text-decoration:none"
use this code in your html file
<style>
a {
text-decoration: none;
color: #000; /* or whatever colour your text is */
}
</style>
Short answer: yes.
Longer answer:
Yes, here is a fiddle, but you probably don't want to hide links from your user.
stslavik makes a good point with "text-decoration: inherit". Here is another fiddle. On my browser the "blam" and "stslavic" both show with strike-through, but I'd go with the "inherit" versus the "none"; just seems better to me.
(P.S not advertising this and no spam. Click on 'Hate AI' to reach my project)
You can do this =>
<h1><a style="text-decoration: none; color: inherit;" href="https://obnoxiousnerd.github.io/hate-ai">Hate AI</a></h1>
<p>A personal assistant that hates you but still helps you.</p>
The logic here was adding a style to the a tag which contains the following:-
text-decoration: none;
color: inherit;
text-decoration for removing the underline under the text.
color: inherit for removing the usual purple color of links.
Sure - just adjust the CSS for 'a' elements on the page.
Just a simple snippit to show some size/coloring possibilities, to make your link fit thematically when the rest of your text a bit better.
Wow, Look at this website! It's called Website! It's a shame that this link looks horrible, though!
<h2><a style="color: #A52A2A;; text-decoration: none;" href="https://www.website.com/">Oh, boy! You can now click here to visit Website's website without the link looking bad!</a></h2>
<h2><a style="color: #A52A2A;; text-decoration: none;" href="https://www.bing.com/">Uh oh, the Website website is broken! Visit the pinnacle of innovation, Bing, instead!</a></h2>
Related
Would like to check what are the approaches that I can use to remove the anonymous blue outline when an email consist of an image href link? I have tried
border: none;
outline: none;
text-shadow: none;
box-shadow: none;
but nothings works.
Remove the border from the image:
a img {
border-style: none;
}
Remove the border by this (if you gave any):
Border:none;
Also try :
<img src="abc.jpg" border="0" />
If there is text decoration then remove it by this:
text-decoration:none;
If there will no changes appear then please you put your code on JSFIDDLE
the problem is not the in a selector but in img selector so you have to remove the border (which is set by default).
since this is for email I would advise you to set border="0" in img, instead CSS above head, just to be more cross-client as possible
something like this:
<img src="img.jpg" alt="img" border="0" />
if you don't like this approach you can always do CSS inline
<img src="img.jpg" alt="img" style="border:0 none" />
See more info about emailing tags/selectors here
I am creating a button using a href tag in my page which is working fine in chrome. but it is not at all working in internet explorer the code for the button is
<td class='swMntTopMenu' style="text-align:right">
<button style="background-color:rgb(255,213,32)">
<a href ='list.php' style="text-decoration:none !important;">
<div class="link"> Back </div>
</a>
</td>
and the code for the style that is been used is
.swMntTopMenu
{
background-color: #E2E4E5;
/* float: center;*/
width: 5%;
margin-top: 2px;
padding-bottom: 6px;
border-bottom: solid 1px #d0ccc9;
}
and
.link
{
color: #0E0202;
text-decoration: none;
background-color: none;
}
can anyone please help me with this?
hope this will help
<button style="background-color:rgb(255,213,32)"> <div class="link"> Back </div> </button>
As I said in the comment, You didn't close your button element. Also, you can't have a in a button element.
Either style the a to look like a button - here's a nice CSS button generator
Or put the button in a form - How to create an HTML button that acts like a link?
In older IE should help declare A as block, when you put div inside.
a {display: block}
Please try using this way
<form action="list.php">
<input type="submit" value="Back">
</form>
How can I remove or just don't display the border links in every anchor with image? By the way, browser settings is in compatibility mode. Answers from other question doesn't suffice to solve my problem. I guess because it only applies with lower version of IE.
EDIT:
I'm currently creating a Custom share buttons where my client requires me.
<div>
<a onClick="window.open('https://twitter.com/intent/tweet?original_referer=#shareLink#&text=#shareTitle#&tw_p=tweetbutton&url=#shareLink#','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">
<img height="20" src="/images/chicklets/Twitter_Tweet.png" />
</a>
</div>
<div>
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=#shareTitle#&p[summary]=#shareDesc#&p[url]=#shareLink#&p[images][0]=images/Telos.jpg','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">
<img height="20" src="/images/chicklets/FaceBook_Share.png">
</a>
</div>
<div>
<a onClick="window.open('http://www.linkedin.com/shareArticle?mini=true&url=#shareLink#&title=#shareTitle#&summary=#shareDesc#','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">
<img height="20" src="/images/chicklets/LinkedIn_Share.png">
</a>
</div>
<div>
<a onClick="window.open('https://plus.google.com/share?url=#shareLink#','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">
<img height="20" src="/images/chicklets/Google_PlusOne.png">
</a>
</div>
CSS:
a {
outline : none;
text-decoration: none;
}
a img {
outline : none;
}
img {
border : 0;
border-style: none;
}
div {
float: left;
padding-right: 10px;
}
Here's what it looks like with IE10:
how about this, try to add something like this
<img src="blah" style="border-style:none;">
I usually use this as part of my normal defaulting set up in my CSS:
img {border: none;}
This doesn't effect the other browsers negatively and is easy to over-ride at a later point if you place this near the top of you general css file e.g
img {border: none;}
img.some-class {border: 1px double blue}
Where the increased specificity will add an ugly border to your image just like IE loves doing.
I was having the exact same issue with IE10. I've just set up a CSS rule for the a tag and set the text colour to white. This removes the blue line from around an anchor image.
Bear with my rudimentary question.
http://jsbin.com/css-play-notfound/6
There is this blue underline thats annoyingly creeping up between my image and Text in the heading.
Two things you can do:
Change this code:
<img src="logo.png" alt="REUNIFY" height="35" />
to this:
<img src="logo.png" alt="REUNIFY" height="35" border="0" />
Also add this to your CSS stylesheet:
a { text-decoration:none }
Note that the above CSS will get rid of the underline on ALL links. So if you want your normal
text links to have the underline and just want this particular link to NOT have the underline,
then create a class like so:
a.noline { text-decoration:none }
and then change your HTML code to this:
<h1><span><a href="http://www.wikipedia.org" class="noline">
<img src="logo.png" alt="REUNIFY" height="35" border="0" />
</a></span>
Welcome
</h1>
Just add the css rule...
text-decoration: none;
... to your <a> element, or to one specific element by using a class or ID.
You can apply it to all hyperlinks like so:
a
{
text-decoration: none;
}
You should always add HTML5 and older browser CSS resets.
http://cssreset.com/ has the most popular ones of 2012. This way, you'll always be starting on a clean slate.
a
{
text-decoration: none;
}
add this in your css
I'm having a hard time with IE6 lately on a particular problem, here's the bit of html I'm on :
<a href="http://www.mylink.com" style="display:block;width:200px;height:200px;">
<span style="display:block;width:100px;height:100px;">
<img src="img.jpg" alt="My image" />
</span>
</a>
Everything is fine with Firefox etc, but the link won't work by clicking directly on the image on IE6 (but will do work anywhere else on the link).
Here is a link:
http://www.daniel-rico.com/demos/ie/
Someone has an idea?
Thanks!
edit: This does not work on IE7 either :/
Thanks for your answers!
I do need the span tag. I should have explained a little more what I was trying to do; here it is:
I need a box clickable. Inside of it I need:
another box with a fixed size which will contain a dynamic image (random ratio)
some text
i just tried it on:
<span style="display:block;width:100px;height:100px;">
<a href="http://www.mylink.com" style="display:block;width:200px;height:200px;">
<img src="img.jpg" alt="Click your image now" />
</a>
</span>
Remove the span tag, I don't think you need it
<div style="width: 200px; height: 200px;">
<a href="http://www.mylink.com" style="display: block; width: 100px; height: 100px;">
<img src="img.jpg" alt="My image"/>
</a>
</div>
If you have control over the markup then extract the inline styles and use
<div id="link">
<a href="http://www.mylink.com">
<img src="img.jpg" alt="My image"/>
</a>
</div>
In the head of the document add a reference to an external stylesheet
<head>
<link rel="stylesheet" type"text/css" href="/Css/Style.css"/>
</head>
Create style.css and add
div#link
{
width: 200px;
height: 200px;
}
div#link a
{
display: block;
width: 100px;
height: 100px;
}
If you are using this style of link in multiple places remove the id on the div and replace with
<div class="link">
...
</div>
And change the selector in the css from # to .
div.link
...
If you are having problems only in IE6 you can also use conditional comments to include a stylesheet that fixes IE6 specific problems
<head>
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="/Css/IE6.css"/>
<![endif]-->
</head>
Oddly enough, removing the width and height properties from the span allows you to click on the image.
<a href="http://www.mylink.com" style="display:block;width:200px;height:200px;">
<span style="display:block;">
<img src="img.jpg" alt="My image" />
</span>
</a>
Of course this completely changes the layout but it might help solve the IE bug.
An alternate method would be to use a div with a background-image instead of an img element:
<a href="http://www.mylink.com" style="display:block;width:200px;height:200px;">
<span style="display:block;width:100px;height:100px;">
<div style="background-image:url(img.jpg);width:100px;height:100px;" title="My Image"><div>
</span>
</a>
Edit:
The background-image solution doesn't work for random ratio image you mentioned in your comment.
If you just want to achieve the layout in the mockup:
<a href="http://www.mylink.com" style="display:block;width:200px;height:200px;padding-left:10px;">
<img src="img.jpg" alt="My image" />
<span style="padding-left:10px;">some text</span>
</a>
I was facing almost an identical problem building a nav in a content-managed site, but compounded by the fact that some of the nav items needed to open in new windows - meaning the solution to use javascript became problematic.
Eventually, I ended up losing the <img... /> tag and replacing with a <span... /> and setting the background image inside the span (I could have used div's but that's bad form according to the W3C).
So referring back to your original example, I'd go with:
<a href="http://www.mylink.com" style="display:block;width:200px;height:200px;">
<span style="display:block;width:100px;height:100px;">
<span style="background-image=url(/img.jpg); width: 50px; height: 50px; display: block;">
<span class="Hidden">My image</span>
</span>
</span>
</a>
The easiest way to make that area clickable is to add position: relative to your link style; to preserve the cursor style under IE6, you can add cursor: hand to your span element.
a{ position: relative; display: block; width: 200px; height: 200px; }
span{ display: block; width: 100px; height: 100px; cursor: hand }
As other suggested, it is better to separate the IE6 specific styling with a conditional comment block.
Hope it helps and good luck ;)
Try to apply to span css property "zoom:0;". It works in my case.
I wasn't able to solve this with CSS only, I used Javascript to force the area to be clickable.
Disappointing, but well, it works...
Thanks everyone for your help ! I appreciate it :)