Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
80 views
in Technique[技术] by (71.8m points)

html - My Links are not working when i make it responsive

This is the HTML part

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="assets/css/styles.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    <script src="https://kit.fontawesome.com/a076d05399.js"></script>
</head>
<body>
    <div class="top-bar">
        <div class="container">
            <div class="row">
              <div class="top-bar-section">
                 <p class="top-bar-question">Do you have any questions? Call Us 0774747790 </p>
              </div>
              <div class="row">
                 <div class="top-nav-bar">
                    <img class="logo" src="assets/images/logo.png" alt="">
                    <ul class="top-nav-options">
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">Home</a></li>
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">Appointment</a></li>
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">Treatment</a></li>
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">Facility</a></li>
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">Gallery</a></li>
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">About Us</a></li>
                        <li class="top-nav-option"><a class="top-nav-option-link" href="#">Contact Us</li></a>
                    </ul>
                 </div>
              </div>
             
            </div>
        </div>
        <div class="row">
              <div class="background-image-block">
              <img class="background-img1" src="assets/images/background.jpg" alt="">
              </div>
        </div>
        <div class="row">
            <div class="box-left">
                
            </div>
            <div class="box-mid">
                
            </div>
            <div class="box-right">
                
            </div>
        </div>
        
    
</body>
</html>

This is the CSS

@media only screen and (min-width: 200px) and (max-width: 275px)
{

    body    
    {
        background-color: #FFFFFF;
    }

    .top-bar
    {
        background-color: #3FA4F6;
        width: 500px;
        height: 40px;
    }

    .top-bar-section
    {
        margin-top: 10px;
        width: 375px;
    }

    .top-bar-question 
    {

        color: white;
        font-size: 12px;
        padding-left: 12px;

    }

    .top-nav-bar    
    {
        width: 375px;
        height: 100px;
    }

    .top-nav-bar
    {
        margin-top: 20px;
    }

    .logo 
    {

        width: 141px;
        margin-bottom: 8px;
        padding-left: 15px;

    }

    .top-nav-option 
    {
        font-size: 17px;
        padding: 4px;
        font-size: 15px;
        list-style: none;
        color: black;
    }

    .background-img1 
    {
        width: 272px;
        margin-top: 176px;
        height: 180px;
        margin-left: 13px;
    }

    .top-nav-option-link
    {
        text-decoration: none;
        color: black;
    }
    
    .top-nav-option-link:hover
    {
        text-decoration: none;
        color: #3FA4F6;
    }

    .box-left 
    {
        width: 229px;
        height: 271px;
        background-color: #3FA4F6;
        box-shadow: 0 0 5px grey;
        margin-left: 38px;
        margin-bottom: 10px;
        margin-top: 10px;
    }
    .box-mid 
    {
        width: 229px;
        height: 271px;
        background-color: #3FA4F6;
        box-shadow: 0 0 5px grey;
        margin-left: 38px;
        margin-bottom: 10px;
        margin-top: 10px;
    }

    .box-right
    {
        width: 229px;
        height: 271px;
        background-color: #3FA4F6;
        box-shadow: 0 0 5px grey;
        margin-left: 38px;
        margin-bottom: 10px;
        margin-top: 10px;
    }


}

The problem is the links are working upto Apartment option. I have figured out problem is with the bootstrap css I'm using.When I remove the bootstrap cdn it works fine but when I put it back It won't work.I need Bootstrap container and row classes cause I have ordered them according to those divs

question from:https://stackoverflow.com/questions/65661097/my-links-are-not-working-when-i-make-it-responsive

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Remove the margin-top from the class .background-img1 and add margin-top: 176px; to .background-image-block class;

The Links are not working because the div with class .background-image-block was on its top.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...