Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Help with HTML code please

Posted by: trishden Apr 16 2012, 11:03 AM

Hi, I'm new to this blogging thing and just had a makeover from a knowledgable web designer. The problem is she set up my social buttons, (facebook, twitter, etc) and they leave my page when clicked on. I would like them to open in a new tab or window. This designer is so busy it take weeks for her to get back to me. I did some research and I think the code needs a target="blank" put somewhere in the code but I'm not sure where. The code is in my sidebar in a text widget and reads as follows:

<center><a href="https://twitter.com/#!/trishden"><img src="http://i939.photobucket.com/albums/ad232/jeags8/twitter1.png"></a>

<a href="https://plus.google.com/117443292363485259367/posts"><img src="http://i939.photobucket.com/albums/ad232/jeags8/google1.png"></a>

<a href="http://www.stumbleupon.com/stumbler/trishden"><img src="http://i939.photobucket.com/albums/ad232/jeags8/stumble_upon.png"></a>

<a href="https://www.facebook.com/pages/A-Fixer-Upper/253768451372938?sk=wall"><img src="http://i939.photobucket.com/albums/ad232/jeags8/facebook_1.png"></a>

<a href="http://feeds.feedburner.com/afixerupper/UiHg"><img src="http://i939.photobucket.com/albums/ad232/jeags8/rss1.png"></a>

<a href="http://digg.com/trishden"><img src="http://i939.photobucket.com/albums/ad232/jeags8/digg1.png"></a>

My site can be found here:
http://afixerupper.com/

Thanks for anyone who has the time to help me. I really appreciate it!

Gratefully,
Trish

Posted by: pandy Apr 16 2012, 11:10 AM

As with all attributes you put it in the start tag.

CODE
<a href="http://example.com" target="_blank">Link text</a>


Note that target can't be used with a Strict doctype since it's been deprecated for many years. It's kinda outdated, for many reasons. It's usually avoided nowadays so you may just want to leave things as they are. The user has every possibility to open pages in new windows anyway if they prefer, but it isn't as easy to stop new windows from opening if that is forced by the site. Open in same window = everyone can get it how they want it. Open in new window = some people will be unhappy and won't like what you are doing.

Posted by: trishden Apr 16 2012, 12:20 PM

QUOTE(pandy @ Apr 16 2012, 12:10 PM) *

As with all attributes you put it in the start tag.

CODE
<a href="http://example.com" target="_blank">Link text</a>


Note that target can't be used with a Strict doctype since it's been deprecated for many years. It's kinda outdated, for many reasons. It's usually avoided nowadays so you may just want to leave things as they are. The user has every possibility to open pages in new windows anyway if they prefer, but it isn't as easy to stop new windows from opening if that is forced by the site. Open in same window = everyone can get it how they want it. Open in new window = some people will be unhappy and won't like what you are doing.


Thanks. I tried it and it didn't work, just screwed up the button. I put it here:

<center><a href="https://twitter.com/#!/trishden"><img target="_blank">Link text</a> src="http://i939.photobucket.com/albums/ad232/jeags8/twitter1.png"></a>

I should highlight that I know nothing about code. Thanks anyway!

Posted by: pandy Apr 16 2012, 01:37 PM

You put it in the wrong start tag. It should be in the start tag for A, not for IMG.

QUOTE
I should highlight that I know nothing about code. Thanks anyway!


Just select the text and hit the button with the hash sign (#) in the menu above.

Posted by: trishden Apr 16 2012, 02:12 PM

QUOTE(pandy @ Apr 16 2012, 02:37 PM) *

You put it in the wrong start tag. It should be in the start tag for A, not for IMG.

QUOTE
I should highlight that I know nothing about code. Thanks anyway!


Just select the text and hit the button with the hash sign (#) in the menu above.



Thanks Pandy for all your help and I appreciate your knowledge but you are talking to an html illiterate. I tried this code:

<center><a href="https://twitter.com/#!/trishden" target="_blank">Link text</a><img src="http://i939.photobucket.com/albums/ad232/jeags8/twitter1.png"></a>

and my twitter button was in-opperable and there was the words "Link text" visible on the site widget that did open my twitter in a new window. Oh well maybe I should just leave well enough alone. I just know it bugs me when I click on someone's fb or twitter and it leaves the page that I might not have been done with.

I guess I came to the wrong help site. I need to find a site that helps the peeps that don't know anything.

Thanks anyway

Posted by: pandy Apr 16 2012, 03:12 PM

No no. The words "link text" were just meant as a place holder and the image must be enclosed in the A tags.

Linking some text or an image is the same thing. The text, or the image, that's contained in A becomes a link. That is, what's between <a href="..."> and </a>. Same goes for all HTML elements, they affect what the contain, not what's outside them.

Posted by: trishden Apr 16 2012, 04:28 PM

OMG, thanks Pandy, I finally got it and it works like a charm! I'm a happy blogger.

Posted by: Darin McGrew Apr 16 2012, 04:36 PM

Please see the FAQ entry http://www.htmlhelp.com/faq/html/docs.html#about-html

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)