Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Catherine Millington
Catherine Millington
3,754 Points

New tab confusion...

My webpage opens a new tab the first time a nav button is clicked but then stays in the same tab after that if I click any other of the nav links after this. Any ideas as to why?

7 Answers

Stone Preston
Stone Preston
42,016 Points

you probably have a target="_blank" attribute added to your navigation links on your home page, but not on the others:

<a href="#" target="_blank">Some link</a>

or possibly in your CSS for that page you could have something like

a {
target-new:tab;
}
Catherine Millington
Catherine Millington
3,754 Points

Here's my code for my nav and i really can't see anything for any links in css.

<div class="grid-container">
        <ul class="grid-12 nav">
            <li><a href="index.html">Home</a></li>
            <li><a href="menus.html">Menus</a></li>
            <li><a href="newsevents.html">News/Events</a></li>
            <li><a href="gallery.html">Gallery</a></li>
            <li><a href="aboutus.html">About Us</a></li>
            <li><a href="contact_us.html">Contact Us</a></li></ul>
    </div>  
Catherine Millington
Catherine Millington
3,754 Points

I have a links to tripadvisor, twitter and facebook on the index page which have blank targets. Could those affect it?

Catherine Millington
Catherine Millington
3,754 Points

I think it happened after i added twitter. Is there anything in here which might affect anything?

<p> <a href="https://twitter.com/thelunesdale" class="twitter-follow-button" data-show-count="true" data-lang="en" data-size="large" data-width="170px" data-align="center">Follow @thelunesdale</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div><br></p> </div>

Stone Preston
Stone Preston
42,016 Points

not that I can really tell. Can you post your CSS for your index page

Catherine Millington
Catherine Millington
3,754 Points
/******Index*******/


* {
    box-sizing: border-box; -ms-box-sizing: -ms-border-box;
    box-sizing: -moz-border-box;}





body {
    background:url("cssimg/landscape1.png") no-repeat center rgb(173,191,206);
    background-clip:border-box;
    background-clip:-ms-border-box;
    background-clip:-moz-border-box;
    background-size:cover;
    background-size:-ms-cover;
    background-size:-moz-cover;
    color: #222;
    font-size: 1.1em;
    font-family: 'Alegreya SC', serif;
}

h1 {font-family: 'IM Fell French Canon SC', serif; font-size:100px; color:#70968C; text-align:center; text-shadow: 4px 4px 4px #000; margin: 0; -ms-text-shadow: 4px 4px 4px #000}

.info {font-family: 'Garamond', serif; font-size:1em; text-align:center; color:#FFF; text-shadow:3px 3px 3px #000; margin:20px; padding:40px; }
.info a{text-decoration:none; color:#FFF;}

.nav {
    list-style-type:none; text-align:center; margin:20px; margin-left:0px; }

.main {
    border: 2px solid #1d2e3a;
    border-radius: 5px;
    background:rgba(160,160,160,.6);
    text-align:center;
    margin:auto;
    vertical-align:top;
    max-width:1200px;
    min-width:600px;
    padding:20px;

}



li {
    display:inline-block;
    border-radius: 5px;
    background:#70968C;
    color: #FFF;
    border:inherit;
    margin-left:10px;
    margin-right:10px;
    border: 2px solid #1d2e3a;
    width:150px;
    height:45px;

}
.nav a {
    padding: 5px 10px 5px 10px; 
    color: inherit;
    text-align:center;
    font-size:24px;
    text-decoration: none;
    display:inline-block;
    vertical-align:top;
    }
.nav a:hover{color:lightblue;}

.col-a, .col-b, .col-c, .hours {

    background: rgba(255,255,255,.4);
    display:inline-block;
    border: 2px solid #1d2e3a; border-radius: 5px;  
    margin-top: 10px;
    padding:10px;
    vertical-align:middle
}

.col-c1 {display:inline-block;
    margin:20px;
    vertical-align:middle;
text-align:center;}

.follow {text-align:center; width:300px; height:200px; margin:auto; border:none; margin-bottom:10px; margin-top: 10px;
    padding:20px; vertical-align:middle
    }

.TA_excellent, .fb-like, .twitter-follow-button {float:right;}

.clearfix {
  overflow: auto;
}
.clearfix {
  overflow: auto;
  zoom: 1;
}

.hours{width:300px; height:150px; margin:auto;}

.col-c {vertical-align:top;}

.col-b img{margin:auto; border-color:#1d2e3a; vertical-align:middle; display:inline; box-shadow:20px 20px 430px -10px rgba(0,0,0,.8);}


footer {color:#FFF; text-align:center; font-size:0.8em;}

a {text-decoration:none; color:#FFF; }


/******Contact Us*******/

/******News and Events*******/

.event, .posts, .reviews,  {vertical-align:top;}
.posts{background: rgba(255,255,255,.4);
    display:inline-block;
    border: 2px solid #1d2e3a; border-radius: 5px;  
    margin-top: 10px;
    padding:10px;
    vertical-align:top}

/******Menus*******/


.dinner::before{content: url(../img/pdf.png); margin:0.8px;}
.lunch::before{content: url(../img/pdf.png); margin:0.8px;}
.sunday::before{content: url(../img/pdf.png); margin:0.8px;}
.mothers::before{content: url(../img/pdf.png); margin:0.8px;}

iframe{border: 2px solid #1d2e3a; border-radius: 5px;}
.food { padding:10px; vertical-align:middle;}



/******Animation****/

.slideshow{animation:slideshow 20s  linear alternate infinite; 
    -webkit-animation:slideshow 20s  linear alternate infinite; 
    max-height:500px; min-height: 400px; max-width:800px; min-width:300px; 
    padding:0px; background:url("cssimg/foodindex.png") no-repeat center;
    background-clip:border-box;
    background-clip:-ms-border-box;
    background-clip:-moz-border-box;
    background-size:cover;
    background-size:-ms-cover;
    background-size:-moz-cover;} }

@keyframes slideshow{ 
0%{background: url(../img/bar-sh.png) no-repeat; opacity:3; background-clip:-ms-border-box; background-size:-ms-cover;}
    5%{background: url(../img/bar-sh.png) no-repeat; opacity:5; background-clip:-ms-border-box; background-size:-ms-cover ;}
    10%{background: url(../img/bar-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    15%{background: url(../img/food-sh.png) no-repeat; opacity:3; background-clip:-ms-border-box; background-size:-ms-cover ;}
    30%{background: url(../img/food-sh.png) no-repeat; opacity:5; background-clip:-ms-border-box; background-size:-ms-cover ;}
    35%{background: url(../img/food-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    40%{background: url(../img/food-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    45%{background: url(../img/whisky-sh.png) no-repeat; opacity:3; background-clip:-ms-border-box; background-size:-ms-cover ;}
    50%{background: url(../img/whisky-sh.png) no-repeat; opacity:5; background-clip:-ms-border-box; background-size:-ms-cover ;}
    55%{background: url(../img/whisky-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    60%{background: url(../img/whisky-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    65%{background: url(../img/restaurant-sh.png) no-repeat; opacity:3; background-clip:-ms-border-box; background-size:-ms-cover ;}
    70%{background: url(../img/restaurant-sh.png) no-repeat; opacity:5; background-clip:-ms-border-box; background-size:-ms-cover ;}
    75%{background: url(../img/restaurant-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    80%{background: url(../img/restaurant-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    85%{background: url(../img/wine-sh.png) no-repeat; opacity:3; background-clip:-ms-border-box; background-size:-ms-cover ;}
    90%{background: url(../img/wine-sh.png) no-repeat; opacity:5; background-clip:-ms-border-box; background-size:-ms-cover ;}
    95%{background: url(../img/wine-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}
    100%{background: url(../img/wine-sh.png) no-repeat; opacity:10; background-clip:-ms-border-box; background-size:-ms-cover ;}}

    @keyframes slideshow{ 
0%{background: url(../img/bar-sh.png) no-repeat; opacity:3; background-clip:border-box; background-size:-ms-cover;}
    5%{background: url(../img/bar-sh.png) no-repeat; opacity:5; background-clip:border-box; background-size:-ms-cover ;}
    10%{background: url(../img/bar-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    15%{background: url(../img/food-sh.png) no-repeat; opacity:3; background-clip:border-box; background-size:cover ;}
    30%{background: url(../img/food-sh.png) no-repeat; opacity:5; background-clip:border-box; background-size:cover ;}
    35%{background: url(../img/food-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    40%{background: url(../img/food-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    45%{background: url(../img/whisky-sh.png) no-repeat; opacity:3; background-clip:border-box; background-size:cover ;}
    50%{background: url(../img/whisky-sh.png) no-repeat; opacity:5; background-clip:border-box; background-size:cover ;}
    55%{background: url(../img/whisky-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    60%{background: url(../img/whisky-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    65%{background: url(../img/restaurant-sh.png) no-repeat; opacity:3; background-clip:border-box; background-size:cover ;}
    70%{background: url(../img/restaurant-sh.png) no-repeat; opacity:5; background-clip:border-box; background-size:cover ;}
    75%{background: url(../img/restaurant-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    80%{background: url(../img/restaurant-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    85%{background: url(../img/wine-sh.png) no-repeat; opacity:3; background-clip:border-box; background-size:cover ;}
    90%{background: url(../img/wine-sh.png) no-repeat; opacity:5; background-clip:border-box; background-size:cover ;}
    95%{background: url(../img/wine-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}
    100%{background: url(../img/wine-sh.png) no-repeat; opacity:10; background-clip:border-box; background-size:cover ;}}


@-webkit-keyframes slideshow{ 
0%{background: url(../img/bar-sh.png) no-repeat; opacity:3; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    5%{background: url(../img/bar-sh.png) no-repeat; opacity:5; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    10%{background: url(../img/bar-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    15%{background: url(../img/food-sh.png) no-repeat; opacity:3; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    30%{background: url(../img/food-sh.png) no-repeat; opacity:5; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    35%{background: url(../img/food-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover ;}
    40%{background: url(../img/food-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover ;}
    45%{background: url(../img/whisky-sh.png) no-repeat; opacity:3; background-clip:-webkit-border-box; background-size:-webkit-cover ;}
    50%{background: url(../img/whisky-sh.png) no-repeat; opacity:5; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    55%{background: url(../img/whisky-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    60%{background: url(../img/whisky-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    65%{background: url(../img/restaurant-sh.png) no-repeat; opacity:3; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    70%{background: url(../img/restaurant-sh.png) no-repeat; opacity:5; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    75%{background: url(../img/restaurant-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    80%{background: url(../img/restaurant-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    85%{background: url(../img/wine-sh.png) no-repeat; opacity:3; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    90%{background: url(../img/wine-sh.png) no-repeat; opacity:5; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    95%{background: url(../img/wine-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}
    100%{background: url(../img/wine-sh.png) no-repeat; opacity:10; background-clip:-webkit-border-box; background-size:-webkit-cover;}} ```
Stone Preston
Stone Preston
42,016 Points

dont really see anything in there that would cause it either. Can you post a link to the site? ill take a look at the source and see if I can find anything

Stone Preston
Stone Preston
42,016 Points

I looked through it and really couldnt find out whats causing it : ( html/css/javascript isnt exactly my forte though so i could have missed something. Its not the link tags themselves though which is what I initially though it was.

Catherine Millington
Catherine Millington
3,754 Points

Thanks for looking anyway. It's a mystery!