Home > database >  Fixed Menu Dissapears on Image Hover Effect
Fixed Menu Dissapears on Image Hover Effect

Time:05-19

I'm fairly new to coding in HTML and CSS.

I have the following HTML and CSS Code, a fixed menu nav bar and an image below that makes an effect on hovering.

How do I go about the image not blocking the menu when zooming in?

Also how do I go about not stretching the image but resizing the div where it is posted in order to fir the browser screen a bit?

* {background-color: black
}
*{
    padding: 0;
    margin: 0;
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  background-color: black;
  font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
  font-size: 20px;
  font-weight: bold;
  height: 65px;
  border-style: dashed;
  border-color:green;
  border-radius: 20px;
  height: 80px;
}

li {
  float: left;
}

li a {
  display: block;
  color: white;
  text-align: center;
  padding: 10px 12px;
  text-decoration: none;
  border-style: dotted;
  margin-left: 24px;
  margin-top: 11px;
}

li a:hover {
  background-color: red;
}

.parrafo{
    font-size: 40px;
    padding: 75px;
    border-radius: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    border-left: 22px;
    padding-left: 150px;
    border-top: dotted 5px red;
    border-bottom: dotted 5px yellowgreen;
    display: flex;
    flex-direction: row;
    font-family: sans-serif;
    font-weight: bold;
    color: white;
    
}

.queonda{
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}

.test{
    margin-left: 200px;
    margin-top: 270px;
}

.test2{
    margin-top: 100px;
    margin-bottom: 100px;
    margin-left: 700px;
}

.portrait {
  overflow: hidden;
  display: inline-block;
}

.portrait img {
  transition: transform 0.5s linear;
  max-width: 100%;
  max-height: 100%;
}

.portrait:hover img {
  transform: scale(1.1);
}

.cat {
 height: 1250px;
 width: 1900px;
}

.algo {
    height: 880px;
    width: 1700px;
    display: block;
}

.active {
  overflow: hidden;
  background-color: #333;
  position: fixed;
  top: 0;
  width: 100%;
}
<div >
    <ul>
        <li><a href="#home">Tour</a></li>
        <li><a href="#news">Listen to Music</a></li>
        <li><a href="#contact">Contact</a></li>
        <li><a href="#about">About</a></li>
    </ul>
</div>

<div ><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>

<div >
    <img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
    <P >MUSIC<br>MAINSTREAM   SELLOUT</P>
</div>

<div >
    <P >VIDEOS</P><br><br>
    <video width="1280" controls autoplay="off">
        <source src="./img/prueba2.mp4" type="video/mp4">

</div>

<footer >
    <div >
        <div >
            <div >
                <h4>Terms & Conditions</h4>
            </div>
            <div >
                <h4><a  href="#privacy">Privacy and Policy</a></h4>
            </div>

            <div >
                <h4>Follow Us</h4>
                <div >

                </div>
            </div>
            <div >
                <div >
                    <h3><a href="#" ></a>
                        <a href="#" ></a>
                        <a href="#" ></a>
                        <a href="#" ></a>
                    </h3>
                </div>
            </div>
        </div>
</footer>

Hopefully you guys can give me some guidancee on this to fix it :)

CodePudding user response:

Just add any positive z-index to navigation.

* {background-color: black
}
*{
    padding: 0;
    margin: 0;
}

.navigation {
  z-index: 1;
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  background-color: black;
  font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
  font-size: 20px;
  font-weight: bold;
  height: 65px;
  border-style: dashed;
  border-color:green;
  border-radius: 20px;
  height: 80px;
}

li {
  float: left;
}

li a {
  display: block;
  color: white;
  text-align: center;
  padding: 10px 12px;
  text-decoration: none;
  border-style: dotted;
  margin-left: 24px;
  margin-top: 11px;
}

li a:hover {
  background-color: red;
}

.parrafo{
    font-size: 40px;
    padding: 75px;
    border-radius: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    border-left: 22px;
    padding-left: 150px;
    border-top: dotted 5px red;
    border-bottom: dotted 5px yellowgreen;
    display: flex;
    flex-direction: row;
    font-family: sans-serif;
    font-weight: bold;
    color: white;
    
}

.queonda{
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}

.test{
    margin-left: 200px;
    margin-top: 270px;
}

.test2{
    margin-top: 100px;
    margin-bottom: 100px;
    margin-left: 700px;
}

.portrait {
  overflow: hidden;
  display: inline-block;
}

.portrait img {
  transition: transform 0.5s linear;
  max-width: 100%;
  max-height: 100%;
}

.portrait:hover img {
  transform: scale(1.1);
}

.cat {
 height: 1250px;
 width: 1900px;
}

.algo {
    height: 880px;
    width: 1700px;
    display: block;
}

.active {
  overflow: hidden;
  background-color: #333;
  position: fixed;
  top: 0;
  width: 100%;
}
<div >
    <ul>
        <li><a href="#home">Tour</a></li>
        <li><a href="#news">Listen to Music</a></li>
        <li><a href="#contact">Contact</a></li>
        <li><a href="#about">About</a></li>
    </ul>
</div>

<div ><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>

<div >
    <img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
    <P >MUSIC<br>MAINSTREAM   SELLOUT</P>
</div>

<div >
    <P >VIDEOS</P><br><br>
    <video width="1280" controls autoplay="off">
        <source src="./img/prueba2.mp4" type="video/mp4">

</div>

<footer >
    <div >
        <div >
            <div >
                <h4>Terms & Conditions</h4>
            </div>
            <div >
                <h4><a  href="#privacy">Privacy and Policy</a></h4>
            </div>

            <div >
                <h4>Follow Us</h4>
                <div >

                </div>
            </div>
            <div >
                <div >
                    <h3><a href="#" ></a>
                        <a href="#" ></a>
                        <a href="#" ></a>
                        <a href="#" ></a>
                    </h3>
                </div>
            </div>
        </div>
</footer>

  • Related