Overlapping text effect with CSS

Currently, I'm in the process of building a website using HTML5 and CSS3. One particular challenge I've come across is when trying to integrate two CSS images together, with one containing a few lines of text.

Let me get straight to the issue at hand - I have successfully created a square image and combined them. The problem arises when adding text within one of these images using:

<p></p>

First, let's take a look at the CSS for the image with text included:

#right {
background-color: #FFFFFF;
height: 900px;
position:absolute;
border-width:1px;
display: block;
border-style:solid;
margin-left: auto;
font-family: 'Ubuntu', sans-serif;
font-size: 85%;
margin-right; auto;
color: #000000;
border-right-color:white;
border-color:grey;border-style:solid;
border-top-left-radius: 5px;
top:300px;
width: 300px;
left:102px;

Next, here is the CSS for the second image:

#middle { 
background-color: #FFFFFF;
height: 900px;
position:absolute;
color: #000000;
display: block;
margin-left:auto;
border-right-color:white;
border-width:1px;
text-align:center;
margin-right; auto;
border-left-color:white;
top:300px;
border-top-color:grey;
border-style:solid;
width: 560px;
left: 390px
}

Now, let's move on to the HTML5 source code:

    <a id="bottom"></a></div>
<!--Begin page -->

<div id="right">
          <p>FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFff</p>
</div>

If my question seems basic or unclear, I apologize. To further illustrate the problem I am facing, I have attached an image for you to reference and better understand the issue at hand.

Answer №1

To achieve the desired result, use the CSS property word-wrap: break-word;. This will ensure that long strings without spaces wrap inside an element that has a specified width.

View Demo

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 way to apply an active class to the parent li element when selecting an item within it? I want to achieve this effect

$(function() { var pgurl = window.location.href.substr(window.location.href .lastIndexOf("/") + 1); $("#nav ul li a").each(function() { if ($(this).attr("href") == pgurl || $(this).attr("href") == '') $(thi ...

After deployment, certain formatting elements appear to be skewed in the React application

After developing a React app with create-react-app, everything was working perfectly. However, upon deployment, I noticed that some styles weren't showing up as expected. The majority of the styling from Material UI is intact, but there are a few dis ...

Navigating through a modal without affecting the main page's scroll position

My webpage has some content, and I also have a modal that pops up on top of it. The problem I'm facing is that when I try to scroll the contents within the modal, only the contents behind it scroll instead. Below is the CSS code: html, body { b ...

Customizing the layout of div elements with Twitter Bootstrap for a responsive design

Utilizing Bootstrap's responsive style sheet, I have organized 4 squares in divs that span 12 columns - |3|3|3|3|. However, when I access this layout on a mobile browser, it displays as: |12| |12| |12| |12| My desired display format is: |6 ...

The alignment of circles and balls is steady, with no bouncing in sight

How can I place a large circle in the center of the screen and four smaller circles on the right side? The small circles should have bouncing balls inside, each with only one ball instead of multiple. An alert should be triggered by the main big circle but ...

The "ID" value for the row that was chosen is unable to be parsed with AJAX JQUERY

After populating an HTML table with data retrieved from a database using PHP, I encountered an issue while trying to fetch the correct ID using AJAX. Following a recommendation to use classes to build my jQuery code, I find myself stuck and unsure of what ...

Issue with React when attempting to add a secondary class to Toggle component

Is there a way to add a second class to my <div> with the class "button"? When I try to append 'toggle-button', the class doesn't seem to work. <CSSTransitionGroup transitionName="buttonAninmated" transitionEnterTimeout={30 ...

Is there a way to automatically make required fields turn red upon form load using model validations in MVC?

After implementing Model validations and remote attribute validation, I noticed that all mandatory fields turn red when the submit button is clicked. Is it possible for all mandatory fields to turn red upon form load instead? ...

having difficulty applying border color to input when clicked

Is there a way to change the border color of an input field on an onClick event? In my scenario, if the 'Other' radio button is selected and a user attempts to save without entering any value in the input field, I want the border color of the in ...

Tips for adjusting the icon size within the <IconContext.Provider> dynamically

Currently, I am using the 'IconContext.Provider' tag to style my icons from the 'react-icons' library. Are there any solutions available to dynamically change the size of the icon based on the size of my media? Is using the global styl ...

Unusual occurrences with Closure commands paired with the "text-align:justify" attribute

Within a Soy template, I have some divs that need to be evenly spaced horizontally. Working Solution: CSS (simplified for example): .list-of-things { position: relative; text-align: justify; } .list-of-things::after { display: inline-block; wid ...

Development of "individual profiles"

This is my first time venturing into web app development and everything is quite unfamiliar to me. I have successfully set up a couple of PHP scripts to interact with an SQL database for user login and registration purposes. However, I now wish to implem ...

Customize a directive in angular js according to the item chosen from a dropdown menu

I have a dropdown menu and a calendar. I have already created custom directives for calendar validation. Now, my goal is to dynamically change the directive based on the selected item in the dropdown menu. Here is the HTML code snippet: <select class= ...

Placing additional text beside a nicely aligned box

I am struggling to figure out how to position text in the center left of a box that is located in the top right corner of my HTML template. <table class="label"> <tr> <td class="sign">F</td> ...

The Android WebView display is consistently showing a blank white screen, failing to reflect CSS or HTML modifications, and exhibiting choppy animations

There seems to be a strange inconsistency when I make changes to CSS classes. Sometimes, after adding a down class name to a button using a touch event, the changes do not appear on the button or anywhere else on the page. It's frustrating how unpredi ...

Animate the transition between the icon and extended variant in Material-UI FAB

If you have a Material-UI FAB with the following code: <Fab size="medium" color="primary" aria-label="add"> <AddIcon /> </Fab> And you want to toggle to this other state: <Fab var ...

When updating the location.hash property via a click event, it appears to be set to

Check out the code snippet below: $(e).click(function() { console.log(this.href); location.hash = this.href; }); In this code snippet, e refers to a <li> element structured like this: <li href="#about">About</li> The location. ...

What is the best way to conceal a parent element with jquery?

Let's say we have the following HTML structure: <li class="fooli"> <a class="foo" href="javascript:foo(this);">anchor</a> </li> <li class="fooli"> <a class="foo" href="javascript:foo(this);">anchor</a> ...

Designing a Stylish Notification Bar using HTML and CSS

Take a look at the code I'm currently working on: <div style="width:100%; position:absolute; border:0px; background-color:#232323; color:#ffffff; padding-top:5px; padding-bottom:5px; font-size:12px" align="center"> TEST TEST TEST TEST TEST Th ...

The div is identified by an ID and a class, but the class is not being utilized by the div

Can someone please explain why the font size, background color, and font weight are not applying to the content in the "welcome" class in this simple HTML/CSS code below? The DIV has both an ID and a class, yet the styles are not being reflected. Any insi ...