0
votes

Design a web page which should contain Bootstrap’s responsive navigation bar, a responsive circle image and a responsive footer.

The snap shot of the web page is given below:

Image 1: Web page in large devices

https://drive.google.com/file/d/1szF9Fc8uX_2wtVw2ase_Lxmg_7ZHitzy/view?usp=sharing

Image 2: web page in small devices:

https://drive.google.com/file/d/1RclzRGsN_PTptMHzrDznFlTzrY2yK5fc/view?usp=sharing

Note:

The web page ‘responsive.html’ template is given. You have to write the code only for the specified part of the 'responsive.html' file and 'app.css' file.

Key Points:

  1. Add responsive feature to the navigation bar. The collapsing nature is tripped by a button with the id ‘btn-id’ belongs to Bootstrap’s navigation toggle class and then features two data- elements. The first, data-toggle, is used to tell the JavaScript what to do with the button, and the second, data-target, indicates various elements like navigation links, forms, and other contents to toggle

  2. Set the navigation brand as ‘MyBrand’.

  3. Create three icon bars (hamburger button) with appropriate Bootstrap class. This will toggle the elements that are in the navigation collapsible div tag.

  4. Add responsive features to the images so that it can automatically adjust to fit the size of the screen.

  5. Make the image to scale down if it has to, but never scale up to be larger than its original size. Set the properties accordingly. For this override necessary css properties of the ‘img-responsive’ class in ‘app.css’ file. Set the max-width of the image to 100% and height to 'auto'.

After written the code I am facing some errors :

Fail 1 : Set the collapsible nature to the button

Fail 2 : Set the icon bar for the 'span' tags

Fail 3 : Set 3 icon bar for the 'span' tags

Fail 4 : The data-toggle should be 'collapse'

Fail 5 : The data target should be the id of the tag for toggling elements like nav links, forms, and other contents.

Can you please tell what should I do after this to resolve these errors.

Here is the code I have written :-

body {
  font-family: 'Open Sans', sans-serif;
}

footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  background-color: #333;
  color: #ddd;
  padding: 20px;
  text-align: center;
}

article {
  padding: 40px;
}

article img {
  text-align: center;
  box-shadow: 6px 6px 8px #777;
  margin-bottom: 20px;
  margin-left: auto;
  margin-right: auto;
}

article p {
  font-size: 16px;
}

.img-responsive {
  max-width: 100%;
  height: auto;
}


/* The following code is used to create same-sized columns 
   in a multi-column layout.
   Code from:  
   http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height
*/


/* columns of same height styles */

.container-xs-height {
  display: table;
  padding-left: 0px;
  padding-right: 0px;
}

.row-xs-height {
  display: table-row;
}

.col-xs-height {
  display: table-cell;
  float: none;
}

@media (min-width: 768px) {
  .container-sm-height {
    display: table;
    padding-left: 0px;
    padding-right: 0px;
  }
  .row-sm-height {
    display: table-row;
  }
  .col-sm-height {
    display: table-cell;
    float: none;
  }
}

@media (min-width: 992px) {
  .container-md-height {
    display: table;
    padding-left: 0px;
    padding-right: 0px;
  }
  .row-md-height {
    display: table-row;
  }
  .col-md-height {
    display: table-cell;
    float: none;
  }
}

@media (min-width: 1200px) {
  .container-lg-height {
    display: table;
    padding-left: 0px;
    padding-right: 0px;
  }
  .row-lg-height {
    display: table-row;
  }
  .col-lg-height {
    display: table-cell;
    float: none;
  }
}
<!-- DO NOT ALTER THIS TEMPLATE. FILL YOUR CODE IN THE SPECIFIED PLACES  -->

<!DOCTYPE html>
<html>

<head>
  <title></title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link href="app.css" rel="stylesheet" />
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


</head>

<body>
  <header>
    <nav class="navbar navbar-inverse" role="navigation">
      <div class="container-fluid">

        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="btn navbar-toggle collapsed" data-toggle="collapse" data-target="#btn-id">
                        <span class="sr-only">Toogle Navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
          <!-- FILL YOUR CODE FOR BRAND AND TOGGLE (ICON BAR) FOR RESPONSIVE NAVIGATION BAR -->
          <a class="navbar-brand" href="#">MyBrand</a>
        </div>

        <!-- Collect the nav links, forms, and other contents for toggling -->
        <div class="collapse navbar-collapse" id="btn-id">
          <ul class="nav navbar-nav navbar-right">
            <li class="nav-item"><a class="nav-link" href="#">Sports</a></li>
            <li class="nav-item"><a class="nav-link" href="#">Activities</a></li>
            <li class="nav-item"><a class="nav-link" href="#">Contact Us</a></li>
          </ul>
        </div>
        <!-- /.navbar-collapse -->
      </div>
      <!-- /.container-fluid -->
    </nav>
  </header>

  <div class=" ">
    <div class=" ">
      <section class=" ">
        <article>
          <!-- WRITE YOUR CODE FOR RESPONSIVE CIRCLE IMAGE -->
          <img class="img-responsive img-circle" id="image" src="https://www.capecod.com/wp-content/gallery/nature-walk-through-harwich-conservation-trust-lands/SK_West-Harwich-Nature-Walk-Through-Consevation-Trust-Lands_10.23.18-7.jpg" alt="Nature Image" />
        </article>
      </section>
    </div>
  </div>
  <footer class="footer">
    <p class=" ">Lorem ipsum</p>
  </footer>
</body>

</html>
1
I suppose this is a homework question. However this site as strict rules and guidelines. Such as askign only one question per question. Therefor please read the guidelines for first: meta.stackoverflow.com/questions/334822/… - stackoverflow.com/help/how-to-asktacoshy

1 Answers

0
votes

Try changing the id of collapsable div from "bin-id" to "bs-example-navbar-collapse-1" so it will look something like this:

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav navbar-right">
        <li class="nav-item"><a class="nav-link" href="#">Sports</a></li>
        <li class="nav-item"><a class="nav-link" href="#">Activities</a></li>
        <li class="nav-item"><a class="nav-link" href="#">Contact Us</a></li>
    </ul>
</div>

This will remove the following errors:

Fail 1 : Set the collapsible nature to the button

Fail 2 : Set the icon bar for the 'span' tags

Fail 4 : The data-toggle should be 'collapse'

Fail 5 : The data target should be the id of the tag for toggling elements like nav links, forms, and other contents.

For the error,

Fail 3 : Set 3 icon bar for the 'span' tags

Try removing the first span (Toogle Navigation) as only 3 span tags are required.

<button type="button" class="btn navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
</button>