GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   how do i let links open in a new window using css? (https://gfy.com/showthread.php?t=470451)

nico-t 05-21-2005 05:37 PM

how do i let links open in a new window using css?
 
I wanna use a class in css to define that the links between that class's tags on the actual page open up in a new window.

Lets say i wanna call this class 'blanktarget', whats the code i gotta put in the style sheet file? U know something like this:
Code:

.blanktarget a {
    href:blank;
}

(^^^^ improvised code just for an example)

so that the links between these tags:
<div class="blanktarget"></div>
open up in a new window.

kenny 05-21-2005 05:39 PM

Why don't you just use TARGET="_blank" in your links like normal?

nico-t 05-21-2005 05:44 PM

Quote:

Originally Posted by kenny
Why don't you just use TARGET="_blank" in your links like normal?

its a hardlink trade list in my blog, but u add the links quickly thru an admin panel..i dont wanna get into the source too everytime i add a link.

Rorschach 05-21-2005 05:44 PM

some people really like to make things more difficult for themselves than they have to be...

nico-t 05-21-2005 05:45 PM

Quote:

Originally Posted by Rorschach
some people really like to make things more difficult for themselves than they have to be...

like you ?

kenny 05-21-2005 05:46 PM

Quote:

Originally Posted by nico-t
its a hardlink trade list in my blog, but u add the links quickly thru an admin panel..i dont wanna get into the source too everytime i add a link.

Can't you edit the program?

nico-t 05-21-2005 05:47 PM

no its a bit more complicated then this. If i could do it more simple id already done it.

xlogger 05-21-2005 05:49 PM

Just add this below </head> ..

Quote:

<base target="_blank">
..and all the links will open in new window.

kenny 05-21-2005 05:52 PM

Quote:

Originally Posted by xlogger
Just add this below </head> ..



..and all the links will open in new window.

There is some HTML that I never knew existed !

You should tell that to whoever wrote this:

http://www.developertutorials.com/tu...311/page1.html

:winkwink:

swedguy 05-21-2005 05:53 PM

It's not possible.

nico-t 05-21-2005 05:53 PM

Quote:

Originally Posted by xlogger
Just add this below </head> ..



..and all the links will open in new window.

thanks, but i want just several "blocks" of links to open in a new window, not the whole page....
Its a wordpress blog, with several php files/templates etc thrown together when u visit the site, thats why the way i want it is, as far as i know, the only option really...

nico-t 05-21-2005 05:54 PM

Quote:

Originally Posted by swedguy
It's not possible.

christ.... u know this 100% sure?

kenny 05-21-2005 05:55 PM

Quote:

Originally Posted by swedguy
It's not possible.

doesn't this code do it? Or am I reading this wrong?

http://www.developertutorials.com/tu...311/page1.html

kenny 05-21-2005 05:56 PM

It's javascript.. but thats ok isn't it?

Robertf 05-21-2005 06:02 PM

You can't do that in CSS ....

As suggested before .. or you let all open i na new window or you will have to add target=.. to the links you wanne open in a new window.

nico-t 05-21-2005 06:10 PM

ok so no css...
Quote:

Originally Posted by kenny
doesn't this code do it? Or am I reading this wrong?

http://www.developertutorials.com/tu...311/page1.html

^^ this might actually work... the internal links, like the category links all open in the same window when i put my domain name in that piece of code.. so im gonna give this one a try! Thanks for the link :)

swedguy 05-21-2005 06:11 PM

Quote:

Originally Posted by kenny
doesn't this code do it? Or am I reading this wrong?

http://www.developertutorials.com/tu...311/page1.html

Javascript is not the same thign as CSS.

kenny 05-21-2005 06:20 PM

Quote:

Originally Posted by swedguy
Javascript is not the same thign as CSS.


I was more or less looking for any kind of a solution

nico-t 05-21-2005 06:20 PM

since css doesnt have this sort of code its a good substite, i just tested this javascript code, and it works perfectly! my blog is now exactly the way i want, thanks :thumbsup

kenny 05-21-2005 06:21 PM

Quote:

Originally Posted by nico-t
ok so no css...

^^ this might actually work... the internal links, like the category links all open in the same window when i put my domain name in that piece of code.. so im gonna give this one a try! Thanks for the link :)


I hope it works out for you :thumbsup

Of course your surfers without javascript aren't going to like it :(

nico-t 05-21-2005 06:24 PM

Quote:

Originally Posted by kenny
I hope it works out for you :thumbsup

Of course your surfers without javascript aren't going to like it :(

yeah ok, but who aint got javascript these days? i thought all the browsers got javascript, only not when u disable it yourself manually.... so i think this solution is fine :)

misterwalrus 05-21-2005 06:26 PM

Quote:

Originally Posted by nico-t
thanks, but i want just several "blocks" of links to open in a new window, not the whole page....
Its a wordpress blog, with several php files/templates etc thrown together when u visit the site, thats why the way i want it is, as far as i know, the only option really...

The <base target="_blank"> tag will work. Add it in to where it needs to be. On my wordpress blog, it is inserted in the index_sidebar.html and the post_sidebar.html. But then again, I don't mind going in and editing a couple lines of code to add a link so I can have my site act the way I want.
Sample:

<div id="menu">
<ul>
<li id="recentposts">Recent Posts
{recentposts mode="list"}
</li>

<li id="categories">Categories:
{sectionlinks mode="list" skip=10}
</li>
</ul>
<ul>
<li id="Links">Links
<ul>
Hand coded links to open in same window are below here!
then...
<base target="_blank">
<li id="Pornblog">Porn Blogs
<ul>
and hand coded links for links I want to open in new window go here!

nico-t 05-21-2005 06:29 PM

^^ nice explanation, gonna try this tomorrow, thanks man :)

Orange Sim 05-21-2005 06:34 PM

You can't do that in CSS.
You are mis-understanding what CSS is for and what it does.

Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.

nico-t 05-22-2005 04:52 AM

misterwalrus, just put that base target code in my blog and it works perfect, thanks!

SGS 05-22-2005 05:46 AM

Quote:

Originally Posted by misterwalrus
The <base target="_blank"> tag will work. Add it in to where it needs to be. On my wordpress blog, it is inserted in the index_sidebar.html and the post_sidebar.html. But then again, I don't mind going in and editing a couple lines of code to add a link so I can have my site act the way I want.
Sample:

<div id="menu">
<ul>
<li id="recentposts">Recent Posts
{recentposts mode="list"}
</li>

<li id="categories">Categories:
{sectionlinks mode="list" skip=10}
</li>
</ul>
<ul>
<li id="Links">Links
<ul>
Hand coded links to open in same window are below here!
then...
<base target="_blank">
<li id="Pornblog">Porn Blogs
<ul>
and hand coded links for links I want to open in new window go here!


Best way of doing it :2 cents:

misterwalrus 05-22-2005 03:02 PM

Quote:

Originally Posted by nico-t
misterwalrus, just put that base target code in my blog and it works perfect, thanks!

Glad to help!


All times are GMT -7. The time now is 06:23 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123