Incorporate a horizontal scrollbar feature within an HTML section

Currently, I am in the process of learning vue js and would like to create a layout that includes two sections. The first section should occupy 3 grids on the screen, be fixed, and not scrollable, with a division into 4 vertical parts. The second section should take up the remaining 9 grids and also be divided vertically into 4 parts, each capable of accommodating a dynamic button. If the buttons exceed the width of the section, a scrollbar should appear affecting section two.

Here is an example of what I aim to build:

https://drive.google.com/open?id=1pek5x1yadgy7v0KV7BjM7NLNYONP0EkJ

This is what I have tried so far :

.listDevice {
  background-color: darkorange;
  height: 140px;
  overflow: hidden;
  overflow-x: scroll;
}

.data {
  overflow-x: scroll;
  display: flex;
}
<div class="row">
  <div class="col col-lg-3">
    <div class="text-secondary text-center">
      <div class="text center">
        <h4 class="name">
          xxxxxx
        </h4>
      </div>
      <div class="text center">
        <h4 class="name">
          xxxxxx
        </h4>
      </div>
      <div class="text center">
        <h4 class="name">
          xxxxxx
        </h4>
      </div>
      <div class="text center">
        <h4 class="name">
          xxxxxx
        </h4>
      </div>
    </div>
  </div>
  <div class=" col col-lg-9 data">
    <div class="listDevice">
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
    </div>
    <div class="listDevice">
    </div>
    <div class="listDevice">
    </div>
    <div class="listDevice">
    </div>
  </div>
</div>

I noticed that adding display: flex dramatically alters the view. Why does this happen?

Answer №1

.listDevice {
background-color: darkorange;
height: 140px;
overflow: hidden;
overflow-x: auto;
display: flex;
flex-wrap: wrap;
flex-direction: column;
width:160px
}
.listDevice button {
height: 30px;
width: 40px;
}
.data {
  overflow-x: scroll;
  display: flex;
}
<div class="row">
  <div class="col col-lg-3">
    <div class="text-secondary text-center">
      <div class="text center">
        <h4 class="name">
          randomtext1
        </h4>
      </div>
      <div class="text center">
        <h4 class="name">
          randomtext2
        </h4>
      </div>
      <div class="text center">
        <h4 class="name">
          randomtext3
        </h4>
      </div>
      <div class="text center">
        <h4 class="name">
          randomtext4
        </h4>
      </div>
    </div>
  </div>
  <div class=" col col-lg-9 data">
    <div class="listDevice">
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
      <button>AA</button>
    </div>
    
  </div>
</div>

Answer №2

Try eliminating the overflow: hidden property from your CSS code.

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

What is the best method for converting a string to an integer when transitioning from CSV to JSON format?

Upon discovering this code snippet designed to convert a CSV file into JSON format, I encountered a specific requirement. In this scenario, the credit field needs to be an integer, which means it should not be enclosed within quotation marks like "". I de ...

jQuery Slider not appearing on the page

I am attempting to incorporate the Basic jQuery Slider into my website. Below is the code I have used: For HTML file: <div id="slides"> <ul class="bjqs"> <li><a href="somelink"><img src="someim ...

Avoid placing content before a link to ensure better focus

I came across some CSS code that closely resembles the following code. (I copied it from http://jsfiddle.net/LmvgM/8/ thanks @thirtydot). I noticed that when the link is focused, the :before content is included. Is there a way to remove it from the highli ...

What is the best way to set the default display of the first option value in a dynamically populated <select> dropdown menu?

I have a field that displays options dynamically. I am looking to set the first option value as the default in the select field. Can someone provide assistance with this? <div class="col-lg-4"> <select name="trader" class="form-control" id="sele ...

Adjust font size using jQuery

Hey there! I have a small question. I want to resize all HTML elements using jQuery, but the current code allows me to increase and decrease the size infinitely. var originalSize = $('html').css('font-size'); // Reset ...

Tips for preserving the status of radio buttons in a React application

I am currently utilizing a Map to keep track of the state of radio buttons, but I am facing challenges when it comes to correctly saving and updating it whenever a user makes a selection. The structure of my Map is as follows: { "Group A": [ ...

What is the proper syntax for adding boolean values to the Realtime Database?

Hello, I am trying to store boolean values in a folder using names like "female" so the name is set to either true or false. This way, I can later retrieve a list of users belonging to a specific group. However, I am unsure about how to update these values ...

I'm curious about how to properly escape single quotes when passing a variable in a Java argument call using Karate DSL. Can you help

As part of our API project at work, I am looking to incorporate database calls into our end-to-end process. One challenge I am facing is how to handle single quotes within a variable that is passed as an argument in an assert method. I have attempted the f ...

Is it possible to conceal a link once it has been visited?

I am trying to figure out how to remove a link from a page once it has been visited. However, I am facing privacy restrictions with the :visited pseudo-class. Is there a way to achieve this without using display: none? For example: .someclass a:link {dis ...

The setState function in React.js fails to properly assign data

Recently, I've been using axios.get() to retrieve data from my database. The response is coming back correctly, but for some reason, when I attempt to update the state with this data, nothing seems to change. import React, { Component, useState, useE ...

I am having trouble retrieving the array value from the response sent by my server

After receiving a dictionary from my server, when I try to access the values using the following code: {"filters":{ "Facture": [ "Магма (Тычок)", "Тонкий кирпич", "Гладк ...

Is it possible to implement a custom radio tab index without using JavaScript

Is it possible to apply the tabindex attribute on custom radio buttons, hide the actual input element, and use keyboard shortcuts like Tab, Arrow Up, and Arrow Down to change the value? Check out this example on StackBlitz ...

Opacity problem when hovering on Chrome

Work in progress: Hello everyone, I'm facing an issue with a hover effect that only seems to be occurring in Chrome. When hovering over a tile, the background color changes, the image opacity decreases, and an icon appears over the image. In Chro ...

Tips on adjusting the height of divs in a simple layout

I'm trying to make two divs fill the page with a ratio of 70% and 30%. However, I don't want to set the size of the "html" or "body" elements. How can I achieve this without affecting the height of the text within the divs? Currently, it only dis ...

Discovering common elements in various arrays of objects

Details: record1 = [{"site": "The Blue Tiger", "zipcode": "E1 6QE"}, {"site": "Cafe Deluxe", "zipcode": "E6 5FD"}] record2 = [{"site": "Blue Tiger", "zi ...

Fade out at varying speeds

As I delve into CSS3 animations, I have been experimenting with some example code. Here is the link to the code: http://jsfiddle.net/chricholson/z7Bg6/67/ I am curious about how to adjust the duration of animations when un-hovering. Currently, it seems th ...

Make sure to fully load the HTML page before running the PHP code

Here is the code snippet I am currently working on: <div class="text-center"> <img src="img/ford_lodding.gif" alt="Loading GIF" style="width: auto; height: 500px;"> </div> <?php require 'php/loading.php';?> The cont ...

Troubles with Bootstrap's navbar dropdown menu functionality

I seem to be encountering a problem with the dropdown list in my navigation bar. It was functioning correctly yesterday, but something seems to have gone awry as Bootstrap is no longer working for the dropdowns only. I'm puzzled as to why this sudden ...

Angular integration of Jquery UI datapicker with read-only feature

Having trouble using ngReadonly within a directive, my code isn't functioning as expected: app.directive('jqdatepicker', function() { return { restrict: 'A', require : 'ngModel', link : functi ...

How can I automatically scroll to an anchor element once CSS animation has finished

I am currently working on a CSS animation that looks like this: @-webkit-keyframes flip { 0% {opacity:1;} 100% {opacity: 0;} //This could be 90% //And here could be frame for 100% which would scroll it down. } #headercover { -webkit-animation-name ...