Issues arise with the behavior of Bootstrap design when adapting to different screen sizes, as well as

I am currently working on designing my personal portfolio using Bootstrap. I have made some progress with the setup, but I am encountering some issues.

  1. When I resize the window, the top menu collapses into a button. However, when I click on the button, nothing happens. The menu should drop down to reveal more options, but it is not functioning as intended, and I am unsure of the cause behind this issue.
  2. The three sections labeled 'I'm an artist' are almost how I want them to be, but there are a few persistent problems. I am aiming to space them out so that on desktop view, they are aligned in a box on the left, center, and right. Additionally, I want these boxes to be centered. On mobile view, I would like the sections (now vertical) to have a slight gap between them, along with a border around each section.

Below is the code snippet:

<!DOCTYPE html>
<html>
    <head>
        <meta charset ="utf-8">
        <Title>"HorrorNerd"</Title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href = "css/bootstrap.min.css" rel ="stylesheet">
        <link href = "css/styles.css" rel ="stylesheet">
    </head>
    <body>

<div class ="navbar navbar-inverse navbar-static-top">
    <div class="container">
        <a href="#" class="navbar-brand">HorrorNerd</a>
            <button class="navbar-toggle" data-toggle="collapse" data-target="navHeaderCollapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        <div class="collapse navbar-collapse navHeaderCollapse">
                <ul class="nav navbar-nav navbar-right">
                        <li class="active"><a href="#">Home</a>
                        <li><a href="#">About</a></li>
                        <li><a href="#">Blog</a></li>
                        <li><a href="http://horrornerd.github.io/artist.html" alt="HorrorNerd's Art Gallery">Artwork</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown" data-toggle="dropdown">Social Media <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Facebook</a></li>
                                    <li><a href="#">Google+</a></li>
                                    <li><a href="#">Linkn</a></li>
                                    <li><a href="#">Pinterest</a></li>
                                    <li><a href="#">Twitter</a></li>
                                </ul>
                            </li>
                            <li><a href="#">Services</a></li>
                            <li><a href="#contact" data-toggle="modal">Contact</a></li>
                    </ul>
                    </div>
                </div>
</div>
<div class="container">
    <div class="row">

        <div class="col-md-4">
                <div class="info">
                <h1>I'm An Artist</h1>
                <p>Art is at the center of my life. I am always creating. Whether it be sketching,coding,listening to music or writing; Art is vital.</p>
                <a href="http://horrornerd.github.io/artist.html" alt="HorrorNerd's Art Gallery" class="btn btn-danger btn-sm pull-right"  >Visit Gallery</a>
                </div>
        </div>

        <div class="col-md-4">
                <div class="info">
                <h1>I'm An Artist</h1>
                <p>Art is at the center of my life. I am always creating. Whether it be sketching,coding,listening to music or writing; Art is vital.</p>
                <a href="http://horrornerd.github.io/artist.html" alt="HorrorNerd's Art Gallery" class="btn btn-danger btn-sm pull-right"  >Visit Gallery</a>
                </div>
        </div>

        <div class="col-md-4">
                <div class="info">
                <h1>I'm An Artist</h1>
                <p>Art is at the center of my life. I am always creating. Whether it be sketching,coding,listening to music or writing; Art is vital.</p>
                <a href="http://horrornerd.github.io/artist.html" alt="HorrorNerd's Art Gallery" class="btn btn-danger btn-sm pull-right"  >Visit Gallery</a>
                </div>
        </div>

    </div>
</div>

<div class="navbar navbar-inverse navbar-fixed-bottom">
        <div class="container">
            <p class="navbar-text pull-left">Site by HorrorNerd.</p>
            <a class="navbar-btn btn-danger btn-sml pull-right">Subscribe on Youtube</a>

        </div>
</div>

<div class="modal fade" id ="contact" role="dialog">
        <div class="modal-dialog">
                <div class="modal-content">
                        <div class="modal-header">
                                <h4>Contact HorrorNerd</h4>
                        </div>

                        <div class="modal-body">
                                <p>This is just a test for now.</p>
                        </div>

                        <div class="modal-footer">
                            <a class="btn btn-danger" data-dismiss="modal">Close</a>
                        </div>

                </div>
        </div>




</div>


<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
    </body>
</html>

Answer №1

1.a To fix the issue, remove the navHeaderCollapse and if you want to keep it, make sure to link to an id of navHeaderCollapse in the div with class class="navbar-collapse collapse". However, this may not be the best approach.

1.b It seems like you missed including a

<div class="navbar-header">
in the navbar section and later tried to include that as navHeaderCollapse. Check out my corrected code on how to work with
<div class="navbar-header">
.

2.a Instead of making all columns equal length, I made them 3 equal lengths so you can have the desired space around them. To evenly distribute the remaining space after having 3 columns of equal length, you need to nest the middle column and apply equal space to both sides using offsetting. Refer to Bootstrap's documentation on Offsetting columns, Grid nesting, and Column ordering for guidance.

2.b For a slight gap when the columns stack up, a media query has been included to adjust the CSS rule and remove default padding on the parent column.

2.c To add borders when the columns stack up, relevant CSS rules are added within the media query for achieving this effect.

Consider moving the styles to a separate "css" folder rather than having them within the HTML document.

Don't forget to include the HTML5 shim and Respond.js for IE8 support in the head section for compatibility with Internet Explorer.

I recommend exploring some Bootstrap tutorials to gain a better understanding of how to utilize it effectively. Learning the basics of Bootstrap is valuable and will definitely benefit your future projects.

Check out the updated HTML and CSS below:

<!DOCTYPE html>
<html>
    <head>
        <!-- Head content here -->
    </head>
    <body>

    <style type="text/css">
    /* Custom CSS styles */
    </style>

    <!-- Navbar and grid layout goes here -->

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="http://getbootstrap.com/dist/js/bootstrap.min.js"></script>

    </body>
</html>

Good luck with your project! If this answer was helpful, please remember to mark it as the correct answer. Thank you :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for centering text in a dijitTextBox:

Ensure that the text is centered vertically with left padding and placeholder text included Check out the image link below: https://i.stack.imgur.com/PbHDa.jpg Snippet of my xPage code: <xe:djTextBox id="djTextBoxSearch" style="width:100%;height: ...

The CSS styling is not being rendered correctly on the AngularJS HTML page

Encountering a puzzling situation here. Our angular controller is successfully delivering data to the page, but we are facing an issue with rendering a table due to an unknown number of columns: <table border="1" ng-repeat="table in xc.tables"> ...

How can I create an input field that only reveals something when a specific code is entered?

I am currently developing a website using HTML, and I would like to create an admin section that requires a password input in order to access. After consulting resources on w3schools, I attempted the following code: <button onclick="checkPassword()" i ...

Tips for incorporating a visible HTML comment in JSX code?

Currently implementing ReactJS and facing a requirement to insert visible HTML comments (visible in the html source) within JSX. Unsure of the correct approach to achieve this. A third party vendor necessitates this comment for processing purposes on the ...

Tips for enhancing redundancy in HTML and ROR using partials

Looking for a way to merge two partials in my Ruby on Rails app without copy-pasting. Here's what I'm aiming for: @member = 'Player' render 'team/team_partial' @member = 'Staff' render 'team/team_partial&a ...

Modify CSS to switch body background image when a DIV is hovered

Feeling a bit lost on where to start with this issue. My divs are positioned as desired on the page. Just to clarify, I am utilizing CSS Grids for this. In short, all I'm wondering is if it's possible to change the background of the body elemen ...

What is the purpose of a form that includes a text input field and a button that triggers a JavaScript function when the enter key is pressed?

<form action=""> <input id="user_input" onKeyDown="if(event.keyCode == 13)document.getElementById('okButton').click()" > <input id="okButton" type="button" onclick="JS_function();" value="OK"> </form> I'm trying to a ...

How to Align Bootstrap Icons in the Center Horizontally

I'm struggling to center Bootstrap Icons within my buttons. The icon appears to be off-center horizontally, and I've tried various methods like text-align and flexbox with justify-content. It seems like the "letter" itself is causing some extra s ...

Is the sliding navigation glitching due to the video background?

Currently, I am in the process of developing a website with a captivating full-page video background. The nav menu gracefully slides out from the left side using jQuery UI when users scroll down to view the site's content. To view the work-in-progres ...

Guide on filling accordion with data from Firebase

I have been working on a web page that retrieves data from my Firestore collection and is supposed to display each document with its corresponding fields. The goal is to populate the accordion with data from Firebase, but unfortunately, nothing is showing ...

What is the reason for adding CSS styles to a JavaScript file without importing them?

/Navbar.js/ import './navbar.scss'; import {FaBars, FaSearch} from "react-icons/fa"; import { useState } from 'react'; function Navbar(){ const [hide,sethide] = useState(true); const barIcon = document.querySelectorAl ...

Building a card carousel component in Vue JS

Struggling with creating a unique card slider using Vue JS? After exploring npm packages like Vue Carousel 3D and Vue Slick, I haven't found the ideal slider for my project. My specific card slider setup is showcased below: In this design, there are ...

Tips for wrapping the content of a <span> element within a <td> element

Can someone help me figure out how to wrap the content of a <span> tag that is inside a <td>? The style I have applied doesn't seem to be working. Here's the code snippet: <td style="white-space:nowrap;border:1px solid black"> ...

How can we ensure only one click event is executed per element type in jQuery?

Here's the issue: I have a list of items with their own content organized in lists. Using jQuery, I've set it up so that when you click on an item, the list expands to show its content. However, when clicking on another item, the previously click ...

Having trouble accessing the input class with jQuery

When I click the "Reset To Default Settings" button in my form, I want to clear the default colors in my 4 color pickers. Each of them has an input type text field with the class anyicon-form-colorpicker. To achieve this, I locate the <a> tag and use ...

Experience the sleek transparency when black hues grace the interface on iOS 14 and above

When implementing the code snippet below, .packages > .ulWrapper::after { background: linear-gradient( to left, var(--edge-color) 5%, rgba(0, 0, 0, 0) 95% ); /* option 1 - red */ background: linear-gradient( to left, var(--edg ...

Background cutting off right side of HTML website

While updating my supervisor's university website, I noticed a problem with the responsiveness. When resizing the browser window, a horizontal scroll bar would appear and the right side of the website would get covered by the background. On mobile dev ...

Adding HTML content inside an iFrame at a specific cursor position in Internet Explorer

Does anyone know a method to insert HTML into an iFrame specifically for IE? I have been using execCommand insertHtml in Chrome and Firefox, but it doesn't seem to work in IE. I was able to paste HTML into a content editable div using pasteHTML, howe ...

Having trouble showing table data in Angular

My goal is to showcase data from a table created using Spring-Boot Below is my model.ts: export class Quiz1 { QuestionId?: any; Question?: string; OptionsA?: string; OptionsB?: string; OptionsC?: string; OptionsD?: string;} He ...

How can I modify the color scheme of radio buttons to include a variety of different hues?

Is there a way to customize the colors of my radio buttons with three different options? I want numbers 1, 2, and 3 to be red, number 4 to be orange, and number 5 to be green... Here is the code I am using: /* Option 1 */ input[type='radio'] { ...