• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

help with links

New Here ,
Oct 24, 2019 Oct 24, 2019

Copy link to clipboard

Copied

Hi ive got navigation links at the top of my website which work well, but when i click on ma link it changes color and also it raises above the rest of the links if you know what i mean.

ive been searching for a fix all day but no luck can someone help ill paste my html then my css thanks.

 

	@charset "utf-8";
	body
.email {
    padding-top: 15px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-left: 10px;
    text-align: center;
}
.navbar-back {
	background: #75DFFA;
}
.recipe {
	font: bold;
   
	

}

	

.meal {
    margin-top: 0px;
    margin-right: 29px;
    margin-left: 30px;
    margin-bottom: 4px;
    font-weight: bold;
	
}


.recbtn {
	background:#C4ECFC;
	font-weight: bold
}
.site {
    background-image: url("../images/background image.jpg");
    width:100%;
    height: auto;
    position: relative;
    left: 0;
    top: 0;
    min-height: 100%;
   
}
.logos {
    padding-right: 2.7%;
    font-size: 3rem;
	
	
	
}
.logo {
    left: 1.3%;
    text-align: left;
    font-weight: lighter;
    font-size: 28px;
    font-family: Baskerville, "Palatino Linotype", Palatino, "Century Schoolbook L", "Times New Roman", serif;
    font-style: italic;
    color: #2E2EA7;
	padding-top: 10px;
	padding-left: 40px
}
.ul{
	
	margin: 0;
	padding: 0;
	position: absolute;
	top: 50%;
	left:50%;
	transform:translate(-50%,-50%);
	display: flex;
		
}
.social{
	
	margin: 0;
	padding: 0;
	position: absolute;
	top: 50%;
	left:50%;
	transform:translate(-50%,-50%);
	display: flex;
		
}
.social li{
	position: relative;
	list-style: none;
	text-align: center;
	width: 80px;
	cursor: pointer;
	
}
.social li .text{
	position: absolute;
	width: 0;
	left:50%;
	margin-top: 10px;
	margin-left: 0;
	transition: 1s;
	overflow: hidden;
	white-space: nowrap;
	font-size: 20px;
	color: #FFFFFF;
		
}
.social li .fa{
	
	font-size: 2em;
}
.social li:hover .text{
	width: 120px;
	margin-left: -60px;
}
.socialmed {
	
	background: #75DFFA;
}
body {
  min-height: 100vh;
  position: relative;
  margin: 0;
}
.soc {
    text-align: center;
}
.top {
	background: #75DFFA; 
}
.description {
    background: #140BE8;
    text-align: center;
    color: #FFFFFF;
}



.burns {
    text-align: center;
    font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
    text-decoration: underline;
    color: #FDFDFD;
}
.easter {
	
	text-align: center;

		
		
}
.halloween {
	
	text-align: center;
}
.valentines {
	
	text-align: center;
}
.andrews {
	
	text-align: center;
}
.xmas {

	text-align: center;
}
.hogmanay {
	
	
	text-align: center;
}
.eastertext {
	
}
.event {
	padding-top: 10px
}
.hog {
	padding-bottom: 10px;
}
.eventback {
    column-width: auto;
    font-size: 1rem;
    font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
    font-weight: bolder;
    background-position: center center;
    color: #000000;
    font-style: italic;
}
.main {
	padding-top: 20px;
	padding-bottom: 20px;
}
.mainpage {
    text-align: justify;
    font-style: italic;
    font-weight: bolder;
}
.rabbie {
	text-align: center; 
	padding-top: 10px;
}
.TARTAN {
	background-image:url("../images/events/images.jpg");
	padding-top: 10px;
	text-decoration-color: #FBF8F8;
}
.burnsnight {
	background: #75DFFA;
}
.supper {
    color: #FFFFFF;
    text-align: center;
    font-style: italic;
}
a:hover {
  color:aqua;
  text-decoration: underline;
}
.valday {
	background: #FF70C0;
	padding-top: 10px;
}
.EASTERSUN {
	background: #EFFD89
}

.SUNDAY {
    color: #F804D8;
    font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
}
.easterevent {
	padding-top: 10px;
	text-align: center;
}
.halo {
	background:#270102;
	padding-top: 10px;
}
.halow {
	text-align: center
}
.hogm {
	background:url("../images/events/ed.jpg");
	padding-top: 10px;	
}
.XMASDAY {
	background-color: rgba(247,3,7,1.00);
	padding-top: 10px;
}
.STANDREWS {
	background-color: rgba(63,41,251,0.82);
	padding-top: 10px;
}
.RECIPES {
	padding-top: 10PX;
	background:rgba(251,13,17,1.00)
}
.ingredient {
    text-align: center;
    font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
    text-decoration: underline;
	
}
.weight {
	 list-style-type: none;
}
.slider {
    color: #FFFFFF;
    font-size: 2.25rem;
    font-weight: bolder;
    font-family: Constantia, "Lucida Bright", "DejaVu Serif", Georgia, serif;
    text-decoration: underline;
    text-transform: capitalize;
    font-style: oblique;
	
}

.carousel-caption{
 
  background-color:rgba(0,0,0,0.2);
}.slider2 {
    font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
    color: rgba(255,255,255,0.88);
    font-size: 1.5rem;
    font-weight: bolder;
    text-transform: capitalize;
    font-style: oblique;
}
.hoverlink a:hover
{
	color:rgba(14,3,253,1.00)
}

.nav-link a:active{
	color: rgba(243,6,10,1.00)
}
	  

	

 

Views

432

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 24, 2019 Oct 24, 2019

Replace 

 

	  <script>
var url = document.URL
var url = url.substr(url.lastIndexOf('/') + 1);
var links = document.querySelectorAll('.navbar-nav li a');
for (var i = 0; i < document.links.length; i++) {
var link = document.links[i].href;
var link = link.substr(link.lastIndexOf('/') + 1);
if (url === link) {
document.links[i].className = 'active';
}
}
</script>
 

 

 

with

 

<script>
  jQuery(document).ready(function($) {
    $(window).on('popstate pushstate', _update);

    _update();

    functi
...

Votes

Translate

Translate
New Here ,
Oct 24, 2019 Oct 24, 2019

Copy link to clipboard

Copied

sorry this is my html

 <body class="site">
	  <div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v4.0&appId=621398881723778&autoLogAppEvents=1"></script>
<div class="container-fluid top">
  <div class="row logos">
    <div class="col-lg-12 logo">Traditional Scottish Food</div>
  </div>
	
  <nav class="navbar navbar-expand-lg navbar-light navbar-back  nav-fill">
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span></button>
    <div class="collapse navbar-collapse" id="navbarSupportedContent1">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item"> 
		<a class="nav-link  meal" href="../Pages/home.html">HOME<span class="sr-only"></span></a></li>
		  
        <li class="nav-item "> <a class="nav-link meal " href="../Pages/starters.html">STARTER<span class="sr-only"></span></a></li>
        <li class="nav-item  hover2"> <a class="nav-link meal " href="../Pages/mains.html">MAIN<span class="sr-only"></span></a>
		  </li>
        <li class="nav-item "> <a class="nav-link meal " href="../Pages/Dessert.html">DESSERT<span class="sr-only"></span></a></li>
        <li class="nav-item "> <a class="nav-link meal " href="../Pages/Events.html">EVENTS<span class="sr-only"></span></a>
		  </li>
      </ul>
		
		
		
		
      <!-- searchbar -->
      <form class="form-inline my-2 my-lg-0" >
        <input class="form-control mr-sm-2 recipe" type="search" placeholder="Recipe Search" arialabel="Search">
        <button class="btn  btn-rounded btn-sm my-0 recbtn" type="submit">Search</button>
      </form>
      <!-- end of search bar -->
    </div>
  </nav>
</div>
<!-- body code goes here -->
	  <!-- TemplateBeginEditable name="EditRegion1" -->
	  EditRegion1
	  <!-- TemplateEndEditable -->
	  
 
	  

<!-- Footer -->



	  
	  
	  
<footer class="page-footer font-small blue pt-4 socialmed">

  <!-- Footer Links -->
  <div class="container-fluid text-center text-md-left">

    <!-- Grid row -->
    <div class="row">

      <!-- Grid column -->
      <div class="col-md-6 mt-md-0 mt-3 offset-lg-0 socialicons col-lg-3">

        <!-- Content -->
		  
         
		 
        <ul class="social">
	      <li>
		  <a href="https://www.facebook.com/Traditional-Scottish-Food-104360860972456" target="_blank"><i class="fa fa-facebook  fa-3x  facebook" aria-hidden="true"></i> </a>
		  <div class="text">FACEBOOK</div>
		 </li>
		 <li><a href="https://www.instagram.com/scottishriver24/?hl=en" target="_blank"><i class="fa fa-instagram  fa-2x instagram" aria-hidden="true"></i> </a>
		  <div class="text">INSTAGRAM</div>
		 </li>
		 <li><a href="https://twitter.com/Derek15449919" target="_blank"><i class="fa fa-twitter  fa-2x twitter" aria-hidden="true"></i> </a>
		  <div class="text">TWITTER</div>
		 </li>
	  
	  
	  </ul>
	 

      </div>
      <!-- Grid column -->

      <hr class="clearfix w-100 d-md-none pb-3">

      <!-- Grid column -->
      <div class="col-md-3 mb-md-0 mb-3">

        <!-- Links -->
        <h5 class="text-uppercase">Links</h5>

        <ul class="list-unstyled">
			<li class="hoverlink">
				<a href="../Pages/home.html">HOME</a>
			</li>
          <li class="hoverlink">
			<a href="../Pages/starters.html">STARTER</a>
			</li>
			
          <li class="hoverlink">
			<a href="../Pages/mains.html">MAIN</a>
			</li>
          <li class="hoverlink">
            <a href="../Pages/Dessert.html">DESSERT</a>
          </li>
          <li class="hoverlink">
            <a href="../Pages/Events.html">EVENTS</a>
          </li>
        </ul>

      </div>
      <!-- Grid column -->

      <!-- Grid column -->
      <div class="col-md-3 mb-md-0 mb-3 col-lg-4 offset-lg-1">

        <!-- Links -->
        <h5 class="text-uppercase">Links</h5>

        <ul class="list-unstyled">
          <li class="hoverlink">
            <a href="../Pages/About Us.html">ABOUT US</a>
          </li>
          <li class="hoverlink">
            <a href="../Pages/Contact us.html">CONTACT US</a>
          </li>
          <li class="hoverlink">
            <a href="../Pages/Privacy Policey.html">PRIVACY POLICY</a>
          </li>
          <li class="hoverlink">
            <a href="../Pages/Terms Of Use.html">TERMS OF USE</a>
          </li>
        </ul>

      </div>
      <!-- Grid column -->

    </div>
    <!-- Grid row -->

  
  <!-- Footer Links -->

  <!-- Copyright -->
  <div class="footer-copyright text-center py-3">© 2019 Copyright:
    <a href=""> Scottishriver.com</a>
  </div>
  <!-- Copyright -->

</div></footer>
<!-- Footer -->  
	  
	  <script>
var url = document.URL
var url = url.substr(url.lastIndexOf('/') + 1);
var links = document.querySelectorAll('.navbar-nav li a');
for (var i = 0; i < document.links.length; i++) {
var link = document.links[i].href;
var link = link.substr(link.lastIndexOf('/') + 1);
if (url === link) {
document.links[i].className = 'active';
}
}
</script>
 
  
	
	  

	  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../js/jquery-3.3.1.min.js"></script> 
	 
  <script src="../js/popper.min.js"></script> 
  <script src="../js/bootstrap-4.3.1.js"></script>
</body>
</html>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2019 Oct 24, 2019

Copy link to clipboard

Copied

Replace 

 

	  <script>
var url = document.URL
var url = url.substr(url.lastIndexOf('/') + 1);
var links = document.querySelectorAll('.navbar-nav li a');
for (var i = 0; i < document.links.length; i++) {
var link = document.links[i].href;
var link = link.substr(link.lastIndexOf('/') + 1);
if (url === link) {
document.links[i].className = 'active';
}
}
</script>
 

 

 

with

 

<script>
  jQuery(document).ready(function($) {
    $(window).on('popstate pushstate', _update);

    _update();

    function _update() {
      var url = window.location.href;

      $('a.nav-link:not([data-toggle]), a.dropdown-item').map(function() {
          $(this).toggleClass('active', this.href == url || this.href == url.split("?")[0].split("#")[0]);
      });

      $('a.dropdown-item.active').map(function() {
        $(this).closest('.nav-item.dropdown').find('.dropdown-toggle').toggleClass('active');
      });
    }
  });
</script>

 

and place it at the bottom of your document, i.e. after adding the jQuery library.

 

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2019 Oct 25, 2019

Copy link to clipboard

Copied

LATEST

Thanks ben that worked perfect mate

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2019 Oct 24, 2019

Copy link to clipboard

Copied

On the web, you really should avoid using spaces in your file names. 

Where you have used Contact us.html, rename it from the DW Files Panel (F2) to one of these.

contact.html

contact_us.html

contact-us.html

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines