issue with website layout due to HTML and CSS

I aligned my text within div tags. As I decrease the size of the page due to the site being responsive, the div tags also shrink, resulting in excessive white space between words. Is there a solution to address this issue? view image here

Another concern involves four black div tags similar to those shown in the image. I aim to make them smaller (sized like the red ones). While setting width and height works on PC browsers, it leads to margins that cause display issues on mobile devices as the page doesn't fit their screens. If the dimensions are not set to 100%, shrinking the page causes text to extend beyond the div borders. Any assistance with this would be appreciated. view image here

The following code pertains to the four div tags.

.first-1{              
    margin: 0px;
    font-family: Arial, Helvetica, sans-serif;
    text-align: justify;    
    display: inline-flex;        
}
.second-2{ 
    
    
    margin: 0px;
    font-family: Arial, Helvetica, sans-serif;
    text-align: justify;
    display: inline-flex;       
}

}
#first-e{
  
    border: solid black;
    border-radius: 10px;
    width: 40%;
    height:40%;      
    font-size: 18px;
    padding: 0px 10px 40px 10px;
    margin: 50px 0px 0px 10px;
    text-align: justify;
    align-content: center;       
}
#second-e{
  
    border: solid black;
    border-radius: 10px;
    width: 40%;
    height:40%; 
    font-size: 18px;
    padding: 0px 10px 40px 10px;
    margin: 50px 0px 0px 10px;
    text-align: justify;       
}
#third-e{
   
    border: solid black;
    border-radius: 10px;
    width: 40%;
    height:40%; 
    font-size: 18px;
    padding: 0px 10px 40px 10px;
    margin: 50px 0px 0px 10px;
    text-align: justify;       
}
#fourth-e{       
    border: solid black;
    border-radius: 10px;
    width: 40%;
    height:40%; 
    font-size: 18px;
    padding: 0px 10px 40px 10px;
    margin: 50px 0px 0px 10px;   
    text-align: justify;    
}
    

Answer №1

To start off, you have the option to insert a new paragraph with some content:

HTML

<p>Your text here</p>

Furthermore, for the second part, consider using CSS floats like demonstrated below:

CSS

.className {
   float: right;
}

Answer №2

If you're facing the initial issue, consider incorporating word-break: break-all;

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

Retrieve the position of an element using Python and selenium

Currently, I am working on a project and need to extract the location and size of an element using the following xpath: "//div[@class='titlu']" https://i.sstatic.net/PI1QE.png Upon inspection, it appears that the element is visible with no dist ...

Execute a JavaScript function when an HTML list element is clicked

As a beginner in web development, I have a question that might seem obvious to some. I want to create a menu where each item, when clicked, triggers a JavaScript function with the item's ID as an argument. I plan to display the menu items in an unorde ...

Why am I not receiving any results from the communication between JavaScript and PHP using an HTTP GET request?

Currently, I have a small JavaScript program running within an HTML5 canvas and included a HTTP GET request function in my JavaScript code. The function itself is functioning properly as I tested it with multiple examples from the internet, all of which wo ...

Conceal the footer when the website is scrolling, reveal it when the website is not scrolling

Before I pose my question, I need to establish two constraints: Must be compatible with IE 7+ Only able to modify the CSS, cannot adjust the HTML/JS So, I have two divs: <div id="content"></div> <div id="footer"></div> "#conten ...

Logo remains in place when scrolling halfway down the page

I have a logo that I want to stay halfway up the home page when scrolling, as if fixed in place until it reaches the footer. body { background-color: #fff; margin: 0; } nav { position: sticky; top: 0; width: 300px; height: 80px; margin:4 ...

Is it possible to close the menu by clicking outside a div or letting it disappear on mouseout after a set period of time?

When visiting a website, you may notice menus that display sub-menus when hovered over. These menus and sub-menus are created using div elements, with the sub-menus hidden initially using style.display = none; The issue arises when a sub-menu is opened an ...

Changing the href of an image when the slide changes: Tips and tricks

Currently, I am utilizing the slick slider slideshow and facing an issue with updating the href of a logo image as the slides progress. Despite trying out two different scripts, none of them have proven to be effective. <main class="Site-content"> & ...

Tips for Personalizing Bootstrap 4.3 Through BootstrapCDN

I'm having trouble customizing the Bootstrap 4.3 BootstrapCDN by linking an external CSS file to override it. Even though I have placed the custom CSS file below the Bootstrap one, it doesn't seem to be taking effect. Can anyone explain why? Th ...

Utilizing Bootstrap 4 to ensure the final DIV is vertically stacked and fills the remaining space in the container

Having trouble creating a responsive layout using Bootstrap 4? Specifically, when two divs wrap vertically on smaller devices, the top div pushes the lower div down, exceeding the parent container. I want the lower div to fit within the container. How can ...

The Bootstrap nav-tab functions perfectly on a local server, but unfortunately does not work when hosted remotely

UPDATE: Issue resolved so I have removed the Github link. It turns out that Github pages require a secure https connection for all linked scripts. Always remember to check the console! I encountered an unusual bug where the Bootstrap nav-tab functionality ...

YouTube videos cannot be embedded using an iframe on Firefox

I inserted a YouTube iframe code inside a div element. <div id="box"> <iframe width="300" height="315" src="//www.youtube.com/embed/82fn4mcNGJY" frameborder="0" allowfullscreen></iframe> </div> After applying CSS to sc ...

Leveraging the :has pseudo-class in Tailwind along with adjacent sibling selectors

My CSS code is working perfectly as intended. [data-type='transfer']:has(+ [data-type^='sale_']) { opacity: 0.25; } This CSS snippet targets elements with data-type="transfer" that are next to elements containing data attri ...

Strategies for handling user typos in a JavaScript prompt

Hi there! Just wanted to say that I'm new to this website, so please forgive any posting mistakes I might make. I'm currently taking a web technology class where we're learning JavaScript. In a previous lesson, we covered HTML5 and CSS. Our ...

Using ESP8266 as a client and setting up an AJAX web server

My goal is to use ESP8266 as a client that will be controlled by a server running on my computer. I want the server to send commands to the ESP8266 using AJAX, and for the ESP8266 to respond to these commands and also be able to send data back to the ser ...

"Utilize jQuery to target and highlight specific HTML elements when redirecting

I am working with a list of elements and I want to be able to redirect the focus to a specific element using a URL. <div id="20"></div> <div id="21"></div> <div id="22"></div> // example url http://localhost: ...

The website does not support the zoom out or scrolling features on iOS devices

A portion of our website has been optimized for mobile devices, however, we have decided to direct iPhone users to the desktop version when accessing the Blogs section (all PHP content) at this time. While this functions properly on an iPad, we have encou ...

Struggling with displaying Vuetify list items correctly?

I am implementing vuetify to display the list items in the following structure: Interests btn1 btn2 btn3 btn4 Not Interests btn1 btn2 btn3 btn4 However, the titles "Interests" and "Not Interests" are not showing up correctly. <v-layout row wrap&g ...

Could my HTML security measures be vulnerable to exploitation?

I have successfully developed a function that accomplishes the following: It accepts a string as input, which can be either an entire HTML document or an HTML "snippet" (even if it's broken). It creates a DOMDocument from the input and iterates throu ...

Ensuring Form Security with JQuery Validation

Hello everyone, I'm currently working on a login form with jQuery validation to ensure that the user ID and password entered are valid. So far, this is what I have implemented: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/l ...

Ensure the continuous flow of text using the Div element

I've successfully implemented a fading image on scroll as desired. However, upon closer inspection here, I've noticed that the text and menu below the image are positioned too far away, especially when resizing the browser window. My goal is to ...