"Trouble in managing heading tag within column due to overflowing instead of adjusting

I have been working on designing a simplistic calendar that displays two weeks with time blocks. While I have created a template for it, I am encountering an issue where the text in the time blocks is overflowing outside their container.

https://i.sstatic.net/G4YMl.png

Here is the HTML code:

<html>
  <head>
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:400,700" />
    <link rel="stylesheet" href="test.css">
  </head>
  <body>
    <div style="width: 80%; margin:auto;">
      <div id="react-calendar">
        ...
      </div>
    </div>
  </body>
</html>

And this is the CSS styling used:


.calendar-container{
    flex-wrap: nowrap;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
}
.calendar-day{
    background-color: #222;
    border-radius: 4%;
}
...

If anyone has any suggestions on how to improve the design or fix the text overflow issue, I would greatly appreciate it!

Answer №1

Success was achieved by utilizing the properties width: max-content; and min-width: max-content.



.calendar-container{
    flex-wrap: nowrap;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
}
.calendar-day{
    background-color: #222;
    border-radius: 4%;
    width: max-content;
}
.calendar-outterblock{
    margin: auto;
    padding: 10%;
    width: max-content;
}
.calendar-innerblock{
    display: flex;
    border-color: #888;
    border-width: 1px;
    border-radius: 2px;
    border-style: dashed;
    justify-content: center;
    align-items: center;
    min-width: max-content;
    padding: 5%;
}

/*
 * Base structure
 */
 html,
 body {
     height: 100%;
     background-color: #333;
 }
 
 body {
     color: #fff;
     text-align: center;
     text-shadow: 0 .05rem .1rem rgba(0,0,0,.5);
 }

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

Limiting text based on the space it occupies

Is it feasible to restrict the number of characters allowed in an input field based on the space they occupy? For instance, W's and M's require enough space for 34 of them. https://i.sstatic.net/xQW5p.png However, regular sentences of the same ...

PHP dropdown menu with pre-selected default value

Currently, I am immersed in a PHP project that has me solving the following challenge: if( mysql_num_rows( $result ) > 0 ) { echo '<select name="officerlist">'; while ( $rows = mysql_fetch_array ( $result ) ) { ...

Including React components in my HTML documents

I have developed a node.js server using express and am rendering an html page with jsx code embedded. The server is running smoothly, but I am encountering difficulties when trying to import other jsx components into my html file to utilize them in my main ...

Utilizing erb within a coffeescript file for modifying the background styling

Is there a way to change the background image of a div based on user selection from a dropdown menu? For instance, if the user picks "white" the background image becomes white, and for "red" it changes to red. I'm struggling with this in coffeescript ...

Using jQuery to dynamically update the CSS of one table column depending on the attribute of another column

Welcome to my HTML table <!DOCTYPE html> <html> <body> <table> <thead> <th>Title1</th> <th>Title2</th> </thead> <tbody> <tr> <td><input type="checkbox" id=0 /></td> ...

Using Javascript to upload an image and show it in a small display

Hey there, I have a functioning JavaScript code that loads an image uploaded by the user onto the HTML page. However, the issue is that the image doesn't have a set maximum height or width, causing buttons on the page to move out of view and become in ...

What is the best way to incorporate both year and month filters using a dropdown menu on a traditional blog website?

I am currently working on a static blog article website and I am looking to implement a 'filter by year and month' feature. This will allow users to easily sort through blog articles based on their preferences. While I have successfully added a ...

Adjust Side Navigation Bar based on window size alteration

I am currently working on implementing a side navigation bar for a website. At the moment, I am utilizing a <nav> element and populating it with <li> items to establish my sidebar. My code snippet is as follows (note: in-line styling is tempor ...

How can we align the Recaptcha and Send button with the text box in a DIV using CSS exclusively?

Struggling to line up my send button and recaptcha with the end of the text box in a contact form in a responsive manner. I've spent days trying to make it work without success. Check out my jsfiddle here: Example Here's the current CSS: /*cust ...

Issue with the <authorization> node in the Web.config file

Whenever I include <authorization>, the page is displayed without the CSS. Does anyone have any thoughts on why this might be happening? Below is my web.config: <?xml version="1.0"?> <configuration> <connectionStrings> <a ...

Menu options are unresponsive to clicks in the dropdown

Need help fixing my dropdown menu issue. Whenever I hover over the dropdown, it disappears before I can click on any items. Here is a snippet of the code causing the problem: #navContainer { margin: 0; padding: 0; padding-top: 17px; width: 220 ...

Div that automatically expands

Currently facing a bit of an issue. I’m attempting to expand and retract the height of #inner upon clicking, with the intention for the height of #container to increase automatically without manually setting it to ‘auto’. Unfortunately, it seems that ...

Using Angular/Typescript to interact with HTML5 Input type Date on Firefox (FF)

Are there any Angular/Typescript projects that are completely built without relying on third-party libraries? I am encountering problems with Firefox and IE11. It works fine on Chrome where the value can be read, but the calendar does not display when us ...

Creating a dynamic category menu using angularJS

I'm struggling with the logic behind creating a category menu using AngularJS I need to display all categories with a parent category id of 0. Once that is done, I want to display all subcategories that belong to each parent category. The final categ ...

Choose the initial search result without actually opening it using jQuery

I am working on an HTML file that contains multiple input fields, which get automatically filled when a corresponding item is selected from the auto-complete feature. Here is a snippet of my HTML code: <table class="table table-bordered"> <u ...

The functionality of Jquery appears to be malfunctioning on the Drupal platform, although it performs

I've built a jQuery carousel that is fully functional when tested locally, but encounters issues when uploaded to a Drupal platform. Surprisingly, the jQuery functions properly when entered through the Console. Here's the jQuery code: carousel = ...

When enlarging or extending the container, text starts to spill out

My issue is that the text content is overflowing the designated box or container - any ideas on how to fix this problem? I have attempted to utilize max-width and max-height, but unfortunately, I am unable to get them to function as intended. Here's ...

Ways to determine the current page I am viewing

I am working with a list of tabs and I need to track my current location every time I click on a specific tab. My MainCTRL controller, which is the parent of all tab controllers, needs to be aware of the active tab at any given moment. I attempted to use n ...

"Using jQuery autocomplete to enhance user experience by providing both value and

Thank you for taking the time to read this. I have been searching for a solution to my problem by reading similar posts, but I am still confused about how to make it work. Here's the issue: I have a jQuery autocomplete that retrieves an array from a ...

Manually set up Bootstrap4 installation

I am exploring the option of manually including Bootstrap4 files in my project and I am curious about the purpose of each file and which ones are essential. When using a CDN, only two files are needed to embed (bootstrap.min.css and bootstrap.min.js). For ...