Moving the layout container towards the left: a quick guide

I am currently attempting to display the legend contents in a horizontal alignment within the layout container. The issue is that while the layout containing the legend aligns horizontally as desired, it extends beyond the screen border. I do not want the legend container to behave this way; instead, I would like the layout container to shift or move to the left. Could you please advise me on how to achieve this?

Kindly provide guidance on achieving both of the points mentioned above.

Code:

<div class="box1" *ngIf="showAreasOfCoverageWithRespectToIntersectedEnvelope==true || showAreasOfCoverage==true">
                        <table>
                            <tr>
                                <td><div id="legend_0_10"></div></td>
                                <td style="text-align: left; vertical-align: middle;">0_10 m</td>

                                <td><div id="legend_10_20"></div></td>
                                <td style="text-align: left; vertical-align: middle;">10_20 m</td>

                                <td><div id="legend_20_30"></div></td>
                                <td style="text-align: left; vertical-align: middle;">20_30 m</td>

                                <td><div id="legend_30_40"></div></td>
                                <td style="text-align: left; vertical-align: middle;">30_40 m</td>

                                <td><div id="legend_40_50"></div></td>
                                <td style="text-align: left; vertical-align: middle;">40_50 m</td>
                            </tr>
                            <tr>
                                <td><div id="legend_50_60"></div></td>
                                <td style="text-align: left; vertical-align: middle;">50_60 m</td>

                                <td><div id="legend_60_70"></div></td>
                                <td style="text-align: left; vertical-align: middle;">60_70 m</td>
                            
                            
                                <td><div id="legend_70_80"></div></td>
                                <td style="text-align: left; vertical-align: middle;">70_80 m</td>
                            
                            
                                <td><div id="legend_80_90"></div></td>
                                <td style="text-align: left; vertical-align: middle;">80_90 m</td>
                            
                            
                                <td><div id="legend_90"></div></td>
                                <td>90 m</td>
                            </tr>
                        </table>
                    </div>

CSS:

#legend_0_10{
  background-color:#ffffff;
  height:20px;
  width: 30px;
}
#legend_10_20{
  background-color:#ffe2e2;
  height:20px;
  width: 30px;
}
#legend_20_30{
  background-color:#ffc6c6;
  height:20px;
  width: 30px;
}
#legend_30_40{
  background-color:#ffaaaa;
  height:20px;
  width: 30px;
}
#legend_40_50{
  background-color:#ff8d8d;
  height:20px;
  width: 30px;
}
#legend_50_60{
  background-color:#ff7171;
  height:20px;
  width: 30px;
}
#legend_60_70{
  background-color:#ff5555;
  height:20px;
  width: 30px;
}
#legend_70_80{
  background-color:#ff3838;
  height:20px;
  width: 30px;
}
#legend_80_90{
  background-color:#ff1c1c;
  height:20px;
  width: 30px;
}
#legend_90{
  background-color:#ff0000;
  height:20px;
  width: 30px;
}
.flex-container {
  display: flex;
  justify-content: center;
  height: 100px;
  width:100px;
  align-content: center;
  align-items: stretch;
}


.flex-container > div {
  background-color: #a00f0f;
  width: 30px;
  margin: 10px;
  text-align: center;
  line-height: 55px;
  font-size: 10px;
}
.box1 {
  background-color: #aaff00;
  width: 498px;
  float: left;
}
            

Screen-shot https://i.sstatic.net/pkCq5.png

Answer №1

For optimal design, consider utilizing a fluid structure rather than relying on static width within the cell or its elements. Instead, apply a table width of 100%.

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 closing process.stdin.on and then reopening it later

I've been facing a challenge with an exercise. In this exercise, the client will input a specific integer x, followed by x other y values separated by spaces. The output should be the sum of each y value, also separated by spaces. For example: Input: ...

Show the "Splash" picture, then switch to a newly uploaded image and show it for a set amount of time

I am in the process of developing an HTML/JavaScript page that will showcase a splash image (splash.jpg) until it gets replaced by another image file called latest.jpg. Once this latest.jpg is displayed, I want it to remain on the screen for 90 seconds bef ...

The pseudo class before is experiencing issues with background color in Safari and not functioning as

Issue with Pseudo class before not displaying background colour in Safari browser To view the code, please visit the following link here HTML <div id='test'> <p>Test </p> </div> CSS #test { position: relative; per ...

What is the proper way to utilize several initialization functions simultaneously?

I have been pondering the concept of using multiple initialization functions and whether it is considered bad practice. When I refer to an initialization function, I am talking about one of the following scenarios: $(document).ready(function(){ //... ...

Full-width header with scrollable content within the viewport

Is there a way to make the header and footer expand to 100% width while keeping the middle content width variable? You can view the source at http://jsfiddle.net/9dWcZ/ HTML: <div class="header"> this is header </div> <div class="content ...

Guide to stacking blocks on top of each other

How can I create even spacing between blocks of different heights? For instance, in the image below, you can see that block 2 should be positioned directly under block 1. https://i.stack.imgur.com/RnYbP.png https://i.stack.imgur.com/LHvlz.png ...

Unlocking the Controller Action: Navigating from a Component Controller in Ember

I am currently trying to enhance the functionality of an Ember component. The specific component I am working on is located here: app / templates / programmers.hbs {{echo-hlabel-tf id= "id-test-hlabel" class="class-test-hlabel-mio" label="Horiz ...

When it comes to Rails and HTML data attributes, should you use a dash (-) or underscore (_) for

I've been encountering issues with HTML custom data attributes in my Rails application recently. I use a specific pattern to add data attributes to HTML tags and then access them later in my JavaScript (jQuery) code, like so: = %a.name{ href: "url.co ...

Sending JSON data from PHP to JavaScript using Ajax

Currently, I am attempting to transfer a JSON object from a PHP script to a JavaScript file using Ajax. The code I have been using successfully for a single string is now being modified to accommodate multiple strings within a JSON object. Below are snippe ...

invoke the getJson function

I am trying to display the data from my JSON file within a div tag on my HTML page. Below is my jQuery code: $(document).ready(function () { $("#driver").click(function (event) { $.getJSON('data.json', function (em) { ...

Need assistance with debugging the current solution for the todo App using Commander or considering a different approach with Readline and Event Emitter?

I'm currently working on developing a CLI for a Node.js exclusive todo application using the commander and conf modules within Node.js, along with chalk to add color to the output. I've encountered some issues that I'm unsure how to resolve: ...

Retrieve new data upon each screen entry

After running a query and rendering items via the UserList component, I use a button in the UserList to run a mutation for deleting an item. The components are linked, so passing the deleteContact function and using refetch() within it ensures that when a ...

What is the best way to update $state in AngularJs when the user makes changes to the controller?

I am currently working on Angular UI Router and I want to refresh the current state by reloading it and rerunning all controllers for that state. Is there a way to reload the state with new data using $state.reload() and $stateParams? Here is an example ...

The value of the HTML input control vanishes once padding is added

I am in need of some assistance with CSS in formatting the text box for BID VALUE (input element) (See in Image 1) Image 1 https://i.sstatic.net/4fQk8.jpg The product link can be found here When I try to widen the text box using padding, the text value in ...

The transition property in CSS and JavaScript does not seem to be functioning properly in Firefox

Recently, I integrated a Slide in menu script on my website using a Slide in menu script. After following all the instructions provided, the menu started working flawlessly on Chrome and Safari browsers. However, my main goal was to make it function on Fir ...

Using Roboto Typeface in Cascading Style Sheets

I am currently working on implementing the "Roboto" font in my Prestashop website. The design files I received are in .psd format, and the graphic designer used fonts "Roboto Medium" and "Roboto Regular". To clarify, if I want to use Roboto Normal, can I s ...

Exploring the Various Path Options in Angular 2 Routing

As a newcomer to Angular and Node JS, I am currently working on an application and struggling with how to efficiently navigate between my different components. Users can input the name of a user and add books associated with them When clicking on a book ...

Collaborate on a component used in multiple modules

In my application, there are two modules: employer and landing. I have created a component in the landing module that I want to share with the employer module. To achieve this, I declared the component in the app.module.ts file of the parent module and use ...

Ways to implement debounce in handling onChange events for input fields in React

I've been attempting to implement debounce functionality in my React app without relying on external libraries like lodash or third-party node modules. I've tried various solutions found online, but none have worked for me. Essentially, in the h ...

Implementing atomic design principles in Vue 3 with TypeScript

I'm currently implementing atomic design principles in my Vue application. Here is the code for my button atom: <template> <ElButton :type="button?.type" :plain="button?.plain" :rounded="button?.rounded ...