What steps should I take to ensure that my layout scales correctly?

Seeking guidance as a beginner coder to master bootstrap 4 scaling. Struggling with proper box scaling down after investing 12 hours into it using various methods like Ul Li and div containers.

If anyone can shed light on where I'm going astray, it would be immensely appreciated.

I've added examples at the end showing how the page should appear across different screen sizes.

Many thanks,

Rob

/*
Colors: 
#4aaaa5; <--teal
#ffffff; <--white
#777777; <--gray

*/

html,
body {
    height: 100%;
    width: 100%;
    font-family: 'Poppins', 'sans-serif';
    color: #222;
}

/* CSS classes and styles */

ul {
    margin: 0 auto;
    display: grid;
    grid-template-columns: 35% 35%;
    background-color: white;
    list-style: none;
    margin: 0 0 0 40px;
}

.footerLine {
    background-color: #4aaaa5;
    height: 70px;
    width: 100%;
}

@media (max-width: 766px) {
    
    /* Media query specific styles for smaller devices */
    
    .robTitle {
        margin-left: 0;
        margin-right: 0;
        padding-top: 20px;
        padding-bottom: 20px;
        width: 100%;
    }

    .navbarLinks {
        justify-content: center;
        width: 100%;
    }

    .contentBack {
        background-color: #ffffff;
        height: 100%;
        margin-left: 0;
        margin-right: 0;
        margin-top: 0;
        margin-top: 110px;
    }

    .robImage {
        width: 100%;
        height: auto;
        align-content: center;
    }

    .contentText {
        word-spacing: .25em;
        line-height: 1.5em;
    }
}

Answer №1

Take a look at this code snippet for inspiration. I've made some changes to the overall layout and design. Please feel free to provide feedback if you'd like any further modifications.

html,
body {
  height: 100%;
  width: 100%;
  font-family: 'Poppins', 'sans-serif';
  color: #222;
  background: #d4d4d4;
}

.portfolio {
  background: #d4d4d4;
}

.robTitle {
  padding: 1.5rem 1rem;
  background-color: #4aaaa5;
  color: #ffffff;
  font-family: 'Georgia', Times, 'Times New Roman', serif;
  width: 300px;
  margin-bottom: 0;
}
... (Code continues) ...
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/style.css">
    <title>Rob Connolly's Portfolio</title>
  </head>

  <body>
    <div class="main-background">
      <!-- Navigation-->
      <div class="row navStyle fixed-top">
        <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
          <h2 class="robTitle text-center">Rob Connolly</h2>
        </div>
        <!--End of the column div-->
         ... (Code continues) ...
        </footer>
        <!--closes footer-->
    </div>
  </body>

</html>

Answer №2

Alright, here's the solution I came up with.

Huge shoutout to @Revti for guiding me in the right direction!

@media screen and (max-width:767px) {
.wordGuessBox {
    height: 300px;
    background-image: url('https://dummyimage.com/300x250/000/fff.png');
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    margin: 30px;
  }
  
  .rpgBox {
    height: 300px;
    background-image: url('https://dummyimage.com/300x250/ff00ff/fff.png');
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    margin: 30px;
  }
  
  .infoBox {
    height: 300px;
    background-image: url('https://dummyimage.com/300x250/ff00ff/fff.png');
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    margin: 30px;
  }
  
  .triviaBox {
    height: 300px;
    background-image: url('https://dummyimage.com/300x250/ff00ff/fff.png');
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    margin: 30px;
  }
  
  .rpsBox {
    height: 300px;
    background-image: url('https://dummyimage.com/300x250/ff00ff/fff.png');
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    margin: 30px;
  }
  
  .boxText {
    color: white;
    background-color: #4aaaa5;
    padding: 10px;
    position: absolute;
    width: 100%;
    bottom: 0px;
  }
  ul {
    margin: 0 auto;
    background-color: white;
    list-style: none;
    display: list-item;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-gap: 20px;
    padding-left: 0;
  }
}

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

Are you experiencing a strange problem with the CSS button when hovering, clicking, or with the border?

Check out the code for this implementation on jsfiddle: https://jsfiddle.net/xuhang1128/cmkbu07s/2/ I utilized React and React-bootstrap to create it. .design2-statusMonitor { margin-top: 20px; .list-group-item { display: inline-block; ...

Using Telegram markdown: Can you combine both bold *and* italic? (September 2018)

After referencing the Markdown Syntax guide on Telegram’s Wiki page, it appears to be quite straightforward to format text as bold and italic. The guide explains that: *this is in italic* and _so is this_ **this is in bold** and __so is this__ ***this ...

Guide on How to Include data (PDF Base 64) in angular 6 component

Within my Angular 6 application, I am presenting data (a report) in a new window using the following code snippet. *** The 'result' variable contains Base64 data *** if (result != null) { const pdfWindow = window.open(""); ...

What causes certain divs to protrude when the parent div has overflow:hidden property enabled?

Issue: I am facing difficulty aligning all elements within one div without any overflow issues. Even with the parent div set to overflow:hidden, some child divs are protruding out of the container. How can I resolve this problem? Example: http://jsfiddle. ...

Issue with sender field in contact form and mailer function

Having issues with my contact form that has 3 fields and a textarea... I've used jQuery for validation and PHP to handle email sending. The contact form is functioning correctly, but the From field in the received emails is not displaying as expect ...

Floating columns in Bootstrap are a great tool for creating

I'm currently working on implementing a specific design layout using Bootstrap, but I've hit a roadblock. Here's the desired layout created with plain CSS: http://jsfiddle.net/n3rLx4n1/ And this is what I've managed to accomplish so f ...

A comprehensive guide on personalizing Bootstrap 4 tooltips to suit your specific needs

I would like to customize the tooltip in Bootstrap 4 based on the screenshot provided below: https://i.stack.imgur.com/wg4Wu.jpg <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta chars ...

What is the best way to extract HTML using selenium.webdriver in Python?

Appreciate your attention, and please excuse any errors in my English. I am currently attempting to retrieve HTML from . The process involves entering some text into an input box and clicking a button, which triggers the following actions: Load the Yaho ...

Adding input fields that change dynamically along with their corresponding radio buttons using AngularJS

Hello, I am struggling with implementing a feature in my HTML and AngularJS files (using Bootstrap ui). I want to create a new input field (td) along with three corresponding radio buttons when the user clicks on an add button. I have attempted to modify t ...

Double execution of JavaScript function when Enter key is pressed

In my HTML page, I have a button that looks like this: <input id="btnLogin" class="loginBtn" type="button" value="Login" title="Login" /> I've set up a jQuery click event for this button: $('#btnLogin').click(function () { Vali ...

The best way to correctly present an HTML document within a UITextView

I am facing an issue with displaying an HTML document inside a UITextView in my iOS app. I have successfully converted the HTML document to an NSAttributedString using a specific extension. extension String { var htmlToAttributedString: NSAttributedStr ...

What is the best way to select photos from a directory and showcase them on a webpage using HTML

I am currently working on developing an image slideshow feature for my website. I have created a basic code that displays a set of images in a slideshow format. However, whenever I add new images to the directory, I have to manually update the code to incl ...

Retrieving data from an API after the onClick event is activated

I'm facing a bit of a challenge with an HTML & JavaScript issue, which I believe should be straightforward to resolve. Since frontend development is not really my forte, I am hoping to find some assistance here. Task: A friend who owns a website buil ...

Issue with nested grid layouts within the 960 grid system

I recently started working on a personal hobby website and decided to utilize the 960 css grid system for organizing my HTML elements on the page. After grasping the basic concept, I went ahead and created a preliminary version of the website, which is ho ...

The menu is not appearing in a horizontal layout

I'm encountering an issue while working on the Foundation Top Bar tutorial. When I view the code in Firefox and Chrome, the top bar displays vertically instead of horizontally. I've attempted changing the display setting to inline and inline bloc ...

Limiting the click event to the parent div only

I've encountered a problem with my overlay setup. I have an overlay with a child div inside, and I want the overlay to close only when the user clicks on the overlay itself, not the child div. Even though I've implemented the closing function, it ...

versatile grid tiles with CSS flexibility

Trying to remove the svg elements while keeping the grid layout intact. The svgs are used to maintain a 1:1 aspect ratio for all tiles. UPDATE: Discovered a CSS Solution for this. Simply set aspect-ratio: 1 for the tiles. Is there an alternative soluti ...

Surprise scrolling on a mobile device's screen

I am trying to figure out why there is a horizontal scroll bar on the page. I would like the content to fill the entire screen. https://i.sstatic.net/Y0ToM.png <section class="who" data-aos="fade-in"> <img class=" ...

Issue with spacing between elements in Tailwind/Nuxt - elements appear too close together

There seems to be a spacing issue when using tailwind v3.4.3 on the Tailwind Playground, with extra space added between span elements. <div> <p> <span class="bg-slate-800">TEST</span> <span class="bg-oran ...

Reference ngFor for Input Validation Template

I'm currently facing an issue with validating input fields within a *ngFor loop. I am struggling to create unique template references for each input field. Basically, I need all input fields to be required on submit unless at least one of them is fill ...