How can I ensure that the elements inside the '.box' are responsive, including dropdown buttons, text, and more?

I have successfully made my banner/header responsive, and I placed the dropdown buttons inside a box. I am new to bootstrap and pretty much new to everything, so I just copied some codes from demos. I need help making this specific box responsive along with the other elements inside it. If the box is not the right solution, any suggestions would be appreciated. Thank you.

Here's the code snippet I am working with:

 img.img-responsive {
   margin: auto;
 }
 .masthead {
   height: 1000px;
   align: center;
   background-image: url("../img/lEy8hs2.jpg]");
   background-attachment: fixed;
   background-repeat: no-repeat;
 }
 body {
   font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
   background-image: url(../img/lEy8hs2.jpg);
   background-repeat: no-repeat;
   background-attachment: fixed;
 }
 .box {
   font-weight: 700;
   box-shadow: inset 2px 2px 10px 10px #FC2B48;
   border-radius: 100px;
   background-color: #7D00C1;
   padding: 50px 100px 50px;
   margin: 50px;
   margin-left: 200px;
   width: 950px;
   height: 1800px;
   color: ##FFE900;
   font-weight: 900;
 }
 /******************************************************
    ROUNDED BUTTONS
    ******************************************************/
 .btn-primary {
   background-color: #BC1A45;
   color: #FFFD7C;
 }
 .btn-lg.round {
   border-radius: 32px;
 }
 /******************************************************
    RAISED BUTTONS
    ******************************************************/
 .btn-primary.raised {
   box-shadow: 0 3px 0 0 #51096D;
 }
 .btn-primary.raised:active,
 .btn-primary.raised.active {
   background: #D31B4C;
   box-shadow: none;
   margin-bottom: -3px;
   margin-top: 3px;
 }
 .box2 {
   margin: 100px;
   margin-left: 300px;
   width: 300px;
   height: 100px;
   color: #F2F918;
 }
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Tekkenetic!</title>

  <link rel="stylesheet" href="css/bootstrap.min.css" />
  <link rel="stylesheet" href="css/style.css" />
  <link rel="stylesheet" href="css/main.css" />
  <link rel="shortcut icon" href="img/favicon.ico" />
</head>

<body>
  <!-- HEADER -->
  <div class "img">
    <div class="masthead">
      <p>
        <img src="img/51e5b810a79ab.png" alt="image" class="img-responsive" />
      </p>
      <div class="box">
        <!-- 1st button -->
        <div class="btn-group">
          <button type="button" class="btn btn-primary btn-lg raised round"><span class="glyphicon glyphicon-home"></span> HOMEPAGE</button>
        </div>
        <!-- 2ND BUTTON -->
        <div class="btn-group">
          <button type="button" class="btn btn-primary dropdown-toggle btn-lg raised round" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-picture"></span> GALLERY <span class="caret"></span> 
          </button>
          <ul class="dropdown-menu">
            <li><a href="#">Game Screenshots</a>
            </li>
            <li><a href="#">Cool Fanarts</a>
            </li>
          </ul>
        </div>
        <!-- 3RD BUTTON -->
        <div class="btn-group">
          <button type="button" class="btn btn-primary dropdown-toggle btn-lg raised round" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class=" glyphicon glyphicon-sunglasses"></span> CHARACTERS <span class="caret"></span> 
          </button>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
            <li><a href="#">Something else here</a>
            </li>
          </ul>
        </div>
        <!-- 4TH BUTTON -->
        <div class="btn-group">
          <button type="button" class="btn btn-primary dropdown-toggle btn-lg raised round" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-plus"></span> EXTRAS <span class="caret"></span> 
          </button>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
          </ul>
        </div>
        <!-- 5TH BUTTON -->
        <div class="btn-group">
          <button type="button" class="btn btn-primary dropdown-toggle btn-lg raised round" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class=" glyphicon glyphicon-info-sign"></span> ABOUT <span class="caret"></span> 
          </button>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
            <li><a href="#">Something else here</a>
            </li>
          </ul>
        </div </div>

      </div>


      <script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
      <script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>

</html>

Answer №1

It looks like you're using Bootstrap, so why not make the most of it by utilizing the Bootstrap container and grid system? Check out http://getbootstrap.com/css/#grid

<div class="container">
    <div class="box col-xs-12 col-md-8">  <!-- Make sure not to specify width for the .box class in your CSS -->
    ...
    </div>
</div>

Answer №2

To ensure your webpage is responsive, it is recommended to utilize Bootstrap's grid system.

  • For screens extra small - utilize col-xs
  • For screens small - utilize col-sm
  • For screens medium - utilize col-md
  • For screens large - utilize col-lg

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

The login form for the MVC website will only auto-submit on IE

I have developed a cutting-edge MVC website that allows users to securely access specific information. However, I am encountering an issue with Internet Explorer - the browser seems to automatically submit the login form when users navigate to the login pa ...

Ways to determine the presence of data in a web browser

I have a code snippet that displays each item in a separate column on the browser. What I want to achieve is to have another page where, upon clicking a button, it will check if that specific item is present on the page. The page that displays the item: ...

Generating CSV File using PHP, AJAX, and MySQL

Currently facing an issue: I am in the process of updating a functional system, which requires me to write code that seamlessly integrates. My goal is to generate a csv file on a php page and store it in a mysql database. Additionally, I am utilizing Ajax ...

Selenium: The function moveToElement is not valid for the driver.actions() method

After creating all my tests using Selenium IDE, I decided to export them to JavaScript Mocha for running in travis. While the tests run smoothly in Selenium IDE and can be exported, I encountered an issue when trying to run them which resulted in the erro ...

Jasmine is having trouble scrolling the window using executeScript

I usually use the following command: browser.driver.executeScript('window.scrollTo(0,1600);'); However, this command is no longer working. No errors are showing in the console, making it difficult to troubleshoot. Interestingly, the same scri ...

Using Javascript to prevent css from changing the display

I want to make some CSS adjustments to a single element using a single script, but I want all the changes to be displayed at once. For example: $("#someelement").css({width:"100%"}); //this change should not be displayed $("#someelement").width($("#someel ...

Customize Cell Styling with Bootstrap Full Calendar CSS

I am attempting to implement a Bootstrap calendar feature where cells are colored green if the timestamp is greater than today's date. This can be achieved by: $checkTime > $today cell.css = green background I came across this code snippet on St ...

ng-if is executed prior to the specified time

This unique Soundcloud player was created using Plangular, a directive that utilizes AngularJS and the Soundcloud API. Due to certain restrictions with third party apps not being able to stream some Soundcloud tracks, I have implemented ng-if="track" and n ...

Displaying the products has an issue with the alignment of heights

I have a project in eCommerce that I'm working on. Currently, I am facing an issue where the height of the product list varies and disrupts the overall alignment when I insert additional content. Below is the code snippet I am using with Bootstrap 4: ...

Exploring various techniques for generating skybox textures in three.js

When it comes to creating skyboxes in three.js, I have noticed two distinct approaches. Assuming we have the following code: var imagePrefix = "images/mountains-"; var directions = ["xpos", "xneg", "ypos", "yneg", "zpos", "zneg"]; var imageSuffix = ".jpg" ...

Tips for getting the jQuery accordion to return smoothly to its original position (instead of stacking on top of each other)

I'm a complete beginner at this and could really use some assistance. Here's my JS Fiddle: http://jsfiddle.net/hAZR7/ The problem I'm facing seems to be more related to logic or math, as the animation works fine when starting and moving to ...

What is the best way to create a scrollable table that extends to 100% of the available width within its container, without taking up the

In the application, there is a collapsed sidebar on the left labeled "sidebar-left" and a container on the right with various types of content labeled "content." The issue arises with the width of this container, as it needs to take up 100% of the remainin ...

Tri-party class switch-up

I successfully implemented two radio buttons to toggle between alternative texts: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> ...

Dynamically showcasing content in an HTML table

Having trouble with this code snippet. It's supposed to iterate through array objects and display them in an HTML table. The third row should have buttons, but nothing is showing up. Can you spot the issue? Here's the HTML code: <html> & ...

Exploring the process of defining directives with Vue 3's composition API

How can directives be defined and used in Vue3's composition API using the new syntactic sugar in SFC <script setup> format? In the past, with the options API, it looked something like this: import click_outside from "@/directives/click-out ...

Utilizing Node.js, delete the author from the database and then use a GET request to display all

Exploring node and express for the first time. I've been working on an example that utilizes GET and POST methods, but now I want to implement DELETE function to delete a book based on its title. Additionally, I need to introduce another GET method to ...

Selenium - Firefox Unresponsive Script Issue

I have encountered an issue where I am getting multiple "Unresponsive Script" pop-ups when opening a page using Selenium. This problem does not occur when I manually open the page using Firefox without Selenium. Strangely, the issue only arises when I open ...

Is it possible to create a .d.ts file to easily share constants between JavaScript and TypeScript?

Currently, I am in the midst of a node.js project that involves both TypeScript and JavaScript due to historical reasons. My goal is to establish project-wide constants that can be utilized in both languages. Initially, I thought about creating a .js file ...

Using the Unleash Feature server in a browser for React projects: A step-by-step guide

I'm currently working on implementing the unleash feature toggle in my React Project. Everything is running smoothly with the backend server (thanks to the Java SDK), but I've hit a roadblock when it comes to making unleash requests from the brow ...

Firebase Cross-Origin Resource Sharing (CORS) and IP range whit

Is there a way to whitelist two IP ranges in order to access my firebase cloud functions? I believe it should be possible to define them within this code snippet: const cors = require('cors')({ origin: true }); I tried searching on Google f ...