The content within div is not adapting to different screen sizes

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

The div content is not responsive. When I resize the browser, the inner content of the div overflows.

I want to make it responsive so that when I reduce the browser size past a certain point, the content will display in a single line without overflowing.

Here's the code I've written:

abc.htm

.projects{
  position: absolute;
  top: 110%;
  height: 110% !important;
  width: 100% !important;
  background-color: #363636;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  vertical-align: top;

}
.project_heading{
  position: absolute;
  top:5%;
  left: 40%;
  font-family:Courier, Monaco, monospace;
  color: #9c9c9c;
  font-size: 1.8em;
  letter-spacing: 8px;
  border: 1px solid black;
}
.skill_sets{
position: absolute;
height: 400px;
width: 200px;
left: 70%;
top: 20%;
border: 1px solid black;
}

.skills_heading{
  position: absolute;
  top:25%;
  
  height: 40px;
  width: 100%;
  /*border: 1px solid black;*/
  font-family:Courier, Monaco, monospace;
  color: #9c9c9c;
  font-size: 1.8em;
  /*letter-spacing: 8px;*/
  background-color: #3a3a3a;
  margin: 40 0px;
}
 <html>
    <head>
    <link rel="stylesheet" media="screen" href="cc.css">
    
    </head>
    <body>
    <div id="content" class="content">
    <!-- <div id="doing_box_closed" class="doing_box_closed">
    </div> -->
    
    <div id="projects" class="projects">
    <p id="project_heading" class="project_heading">PROJECTS</p>
    <div id="skill_sets" class="skill_sets">
    <p id="skills_heading" class="skills_heading">Skills</p>
    </div>
    
    </div>
    
    
    </div>
    </body>
    </html>

Answer №1

The issue lies within your CSS code for the .skill_sets class. Consider the following adjustments:

.skill_sets {
    /* position: absolute; */
    height: 400px;
    /* width: 200px; */
    /* left: 70%; */
    top: 20%;
    border: 1px solid black;
}

By using position:absolute, you are specifying a fixed element positioning along with a specific left:70% and width:200px. This can result in the element overflowing its container.

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

How can I customize both the message and icon in a Dynamic Dialog component using Angular PrimeNG within a single component?

Can someone help me with styling the message and icon properties of just a single dialog in this .ts file? I'm encountering an issue where the provided .scss code is affecting the styling of all dialogs throughout the entire app, which is not what I i ...

Floating DIVs wrapped in a responsive layout

I can't help but wonder if I have a layout like this: <div class="container"> <div class="left"> Left </div> <div class="right> Right </div> </div> Changing the view port to 320 pixels requires the right div to ap ...

Ways to align a bootstrap 4 row both vertically and horizontally in the center amidst other rows

Assume there is a main menu followed by three rows. The first row should be at the top and the third at the bottom, while the second row needs to be centered both vertically and horizontally. As you scroll down, the main menu should be able to hide while ...

New data row successfully added to HTML table, revealing an object display

When I click a button, a dialog box opens up. I can fill out the form inside the dialog box and submit it to insert a row into a table. After submitting the form, the newly inserted row displays as [object Object] immediately after submission: https://i.s ...

Instructions for importing jpeg images from a directory and displaying them in a rendered HTML file using R

Currently, I am utilizing the following approach to read files from a directory: require(magick) require(purrr) folder <- list.files("location/to/folder_directory", pattern = ".jpeg", full.names = T) image_plots <- map(folder, im ...

What sets XHTML 1.1 apart from other document types?

Visit this page for more information: XHTML 1.1 makes it simple to create various display formats, including printing pages, wireless device and PDA pages, and browser pages for television by creating a new CSS (cascading style sheet) for the specific ...

Leveraging numerous Yii applications

In my directory structure, I have the following: root/ root/protected root/framework root/backend root/backend/protected The first Yii application is located directly inside the root folder at the same level as the framework folder. The second Yii applic ...

Can we dynamically adjust font size based on the width of a div using CSS?

My div is set to 70% width and I have a specific goal in mind: To fill that div with text To adjust the font size so that it takes up the entire width of the div https://i.stack.imgur.com/goVuj.png Would it be possible to achieve this using only CSS? B ...

The iPad1 is having trouble displaying the background image, while the iPad2 is showing it perfectly

I am experiencing issues with the background image on my website not displaying properly on an iPad 1, however it appears fine on an iPad 2. Does anyone have any suggestions or ideas on how to fix this? Thank you in advance. ...

Container automatically resizes to fit the width of an image, while ensuring all other buttons and elements remain neatly enclosed within

My website consists of four main sections, each with a background image of the same size. These images contain important elements that I always want to be visible. Initially, the images would resize based on the browser window size, but a recent CSS cleanu ...

What is the proper way to define an attribute that begins with [ and concludes with ]?

Is there a way to declare an attribute with [] notation? I am using font-awesome and trying to change the [icon] attribute value from faLockto faUnlock on click using Angular/Typescript. However, when I try to do this, I am encountering the following error ...

how to style field color for invalid input in angular reactive forms

I am currently working with ReactiveForms and I am having trouble finding a way to modify the color of the form field outline when the input is considered invalid. It is important for me to adjust this color because the current red shade does not blend we ...

I'm curious if there is a tool available for comparing front-end testing results on a WordPress site, particularly to identify any differences before and after making updates

When updating plugins, there is always a risk of something breaking. Before proceeding with the update, it's a good idea to capture a screenshot or recording of the website using the provided tool. This way, you can compare the before and after versio ...

Setting a title for an ashx file: A step-by-step guide

Is there a way to change the page title for the opened window when a user views an ashx file in the browser? Currently, when users click on a document that opens in a new tab (Word, Excel, PDF, etc.), the page title shows something like "file.ashx?id=5". I ...

Adjusting the spacing between dropdown menu items in Bootstrap sass with Rails

After adding the bootstrap-sass gem to my app, I have implemented two dropdown menus on the right side of the screen. Although they are horizontally aligned, I find that they are too close to each other. I would like to create some space between them and ...

Notification of failed fetch in backbone

We are experiencing a problem with our backbone application. Our goal is to show a notification to the user when a fetch fails (due to timeout or general error). Instead of displaying an error message on a new page, we want to overlay a dialog on top of th ...

Steps for updating the value of angular inputs within a function

When a card is selected on the page below, the input values should be updated with information from a JSON object. Here is the JSON data: { "status": true, "data": [ { "id": 1, "pessoa_id": 75505 ...

Shift the element upwards instead of scrolling down the page

I'm struggling with a design challenge on my website. Currently, the page layout consists of a navigation bar, a header section, and the main body content. I'm trying to achieve a scrolling effect where the body content moves up and over the head ...

Styling borders of an image

I am working on an application where I have a collection of images. When the user clicks on an image, it receives a thick border around it at a certain distance. Now, I want to customize this border to reduce the spacing between the image and the border b ...

relocate the figcaption below the image on mobile devices

Currently, I am in the process of updating an old website to make it responsive, and I have encountered several challenges along the way. My goal is to have the fig captions displayed on the right side in the desktop version, but underneath the figure in ...