How put url to another page in css - html

I need to put a link to another page in my h2 element. I don't want use href but I need to do this with css
Suppose to have this:
<h2 class="path">Edizione</h2>
And in my css
. path {
url: 'https://www.w3schools.com/css/css_link.asp';
}
Anyone can help me?

Sorry, but you can't do this with CSS. Also, I'm pretty sure href is for the <a> tag.
If you want your <h2> to be a link, either wrap it with an <a> tag, or put the <a> tag inside it, like this:
<h2>link</h2>
<h2>link</h2>

CSS Doesn't let you do redirects, instead try using JavaScript's built in Window.location method. If you have an even binding for an (onClick) event simply add this code inside of the callback and your page will re-direct to the url provided.
Window.location = 'https://www.w3schools.com/css/css_link.asp';

Related

URL in anchor tag is not working

I want to link one HTML page to another one. So, I use anchor tag
<a href="xyz.html>sign</a>.
As my "xyz.html" is in the current folder and on click on "sign", it does not work.
Even I also applied jQuery on click method.
Assuming "sign" is in your anchor tag, try this :
Sign
You not Close the double quote
sign
The<a> tag defines a hyperlink, which is used to link from one page to another

HTML anchor link going to the same page with different query string

Within a web document (http://example.com/bla.php?x=123&y=321), is it possible to create an anchor link which goes to http://example.com/bla.php?z=111 without putting bla.php in the anchor's href?
This should work:
link

Can disable or comment inside value of href in anchor tag?

My problem is i wanna have some comment or disable some text inside value of href attribute of anchor tag.
I mean look like this:
Jquery.com
And when i click url redirect to stackoverflow.com and behave with domain.com like a comment or don't have any effect to link. Value in square bracket just like a comment inside url :[domain.com]
Can i do this without using jquery or javascript just like // or /**/ for normal comment inside code.
Please help me and thanks for reading.
Comments in HTML are this way :
<!-- [domain.com] -->
but that won't work in your case.
Why do you need to leave the [domain.com] if you want it to be effectless ?
Anyway, you could do something like that :
Jquery.com
and JS:
$('a.linkWithComment').click(function(e) {
$(this).attr('href', $(this).attr('href').replace(/\[(.*)\]/g,''));
});
Here's a JSFiddle for it : http://jsfiddle.net/kJDUB/
BUT be aware that this is absolutely not a recommended behaviour: SEO is probably broken, and there a many solutions to achieve same behaviour while being cleaner (like HTML5 tags : Jquery.com
and you can still reach the domain.com ...)

DOM problem when trying to extract HREF

I used DOM in order to extract all HREF-s from given html source. But, there's a problem: If i have link like this one:
<LINK rel="alternate" TYPE="application/rss+xml" TITLE="ES: Glavni RSS feed" HREF="/rss.xml">
then "href" element will be presented as /rss.xml, although that "/rss.xml" is just anchor text. Clicking on that link from Chrome's page source view, real link is opened.
I would like to take that href-s LINK, not anchor text. Please, how can i do it with dom?
Get a hold of the link element and get its href property. Suppose you were using an id,
<link id="myLink" rel="alternate" href="/rss.xml" />
var link = document.getElementById("myLink");
link.href; // http://www.example.com/rss.xml
"href" element will be presented as /rss.xml
Yes, that is the value of the attribute
although that "/rss.xml" is just anchor text.
No. <link> elements don't have anchor text. In the following example 'bar' is anchor text.
bar
Clicking on that link from Chrome's page source view, real link is opened.
Browsers know how to resolve relative URIs.
I would like to take that href-s LINK, not anchor text. Please, how can i do it with dom?
You can't use DOM to resolve a URI. You use DOM to get the value of the attribute and then use something else to resolve it as a relative URI.
The article Using and interpreting relative URLs explains how they work, and there are tools that can help resolve them.
You need to know the base URI that the relative URI is relative to (normally the URI of the document containing the link, but things like the base element can throw that off)
In Perl you might:
#!/usr/bin/perl
use strict;
use warnings;
use URI;
my $str = '/rss.xml';
my $base_uri = 'http://example.com/page/with/link/to/rss.xml';
print URI->new_abs( $str, $base_uri );
Which gives:
http://example.com/rss.xml
You can try using document.location.href to get the current URL and append the result you are getting from your example. That should give you an absolute path for the link.

double action link

Can I create a link that has another link in html.
For example, I want to call an html form and the target will be the sidebar frame.
At the same time, the board frame will also go back to the previous page.
I don't think you would be able to do this in plain HTML, but you could probably use JavaScript to accomplish what you're after.
as steve mentioned you need a bit of javascript:
<iframe id="frame1"></iframe>
<a href="" onclick="update();return false;" >DoubleActionLink</a>
<script>
function update() {
window.open("http://www.stackoverflow.com");
parent.document.getElementById('frame1').src="http://www.w3c.org";
}
</script>
btw, you said
I want to call an html form
html form means you'll submit something to web server...so you aren't asking for pure html solution. Isn't ?
The w3 specification about links clearly states that this is forbidden ..
12.2.2 Nested links are illegal
Links and anchors defined by the A
element must not be nested; an A
element must not contain any other A
elements.
But you can handle the click event through javascript and do additional actions when clicked..
Use target="_top" and set the href to the URL of a <frameset> document which loads all the frames you want by default.
Better yet, don't use frames. They are more trouble than they are worth.