Text breaks down as it stretches past a certain length

Implementing a manual line break resolves the issue, however, without it, everything becomes jumbled together.

Here is the CSS code being used:

header {
    background: #fcb9aa;
    color: #f3d9d9;
    height:100px;
    margin: 0;
    padding: 0;
    position: relative;
    text-align:right;
}
ul {
    position: relative;
    margin-top: 0px;
    padding-left: 10px;

}
header li {
    display: inline-block;
    margin:30px;

    
}
body{
    margin:0;
    padding: 0;
    margin-top: 0;
    background-color: white;
    font-family: 'Pacifico', cursive;
    
}

a, a:hover, a:focus,a:active{
    text-decoration: none;
    color:inherit;
    font-size: 30px;
    font-family: 'Pacifico', cursive;

}
a:hover{
    color: #55cbcd
}
h1 {
    margin: 40px;
    text-align: center;
    font-family: 'Pacifico', cursive;
}
h2 {

}
.logo{
    border-radius: 50%
}
div.nexto{
    display: inline-block;
    position: relative;
}
.contentl figure{
    height: auto;
    width: 600px;
    overflow: hidden;

}
.contentl figure img{
    height:auto;
    width: 600px;
    transition: transform .3s ease;
}
figure img:hover{
    transform: scale(1.5)
}
div.content{
    margin:0;
    padding:0;
    position: relative;
    top: -400px;
    left: -20px;
    text-align: left;
    overflow-wrap: break-word;
}
.substance{
    font-family: Arial, Helvetica, sans-serif;
    overflow-wrap: break-word;
}

This is the HTML content:

<body>
  <header>
    <ul>
      <li><a>HOME<a></a></li>
      <li><a href="albums.html">ARTICLES</a></li>
      <li><a href="singles.html">CONTACT</a></li>
      <li><a href="artists.html">ABOUT US</a></li>
    </ul>
  </header>
  <section>
    <h1>Welcome to my website</h1>
  </section>
  <section class="contentl">
    <div class="nexto">
      <figure>
        <img src="img/ph1.jpg" alt="im1">
      </figure>
    </div>  
    <div class="nexto">
    <div class="content">
        <h1 class="date">6/7/2021</h1>
        <h2 class="name">
          PSYCHOLOGY STUFF
        </h2>
        <h3 class="substance">Psychology is the science of mind and behavior. Psychology includes the study of conscious and unconscious phenomena,<br> as well as feelings and thought. It is an academic discipline of immense<br> scope. Psychologists also seek an understanding of the emergent properties of brains, linking the discipline to neuroscience.</h3>
    </div>
  </div>
  </section>
  
</body>
</html>

The issue lies within the h3 tag's formatting, necessitating a custom line break to resolve it.

I would greatly appreciate any suggestions or tips on optimizing my code as I currently find it quite complex and confusing to navigate.

Answer №1

If you want to style your h3 tag with a specific width, consider placing it within another HTML tag for additional customization options.

Utilizing CSS frameworks such as bootstrap or bulma can simplify the process of creating visually appealing UI designs with minimal effort.

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

Implementing translation text into a PHP database

<!doctype html> <html> <head> <meta charset="utf-8"> <title>Translate and Save Text</title> </head> <body> <form action="" method="post" name="theform"> <table width="693" border="1" style="table-l ...

Allowing SVGs to be clickable without disrupting the functionality of YouTube videos

I'm experiencing an issue with the overlapping of the svg and YouTube elements. If you hover your mouse over, just to the right of the svg and click, instead of opening the video, it redirects you back to the previous page. Clicking on the area betw ...

Issues with HTML5 file uploads causing delays in iOS Safari mobile browsers

I developed a simple HTML5 file upload script using $.ajax(). I also attempted to use xhr, but encountered the same issue. The script successfully uploads an image to imgur.com and works flawlessly on desktop browsers as well as iOS Safari. However, in iOS ...

Unexpected resizing occurs when SVGs are nested within each other

I am experimenting with using nested inline SVGs to creatively position smaller svg images within an svg container. However, I am finding it challenging to grasp the guidelines for sizing nested SVG elements. svg { display: block; } Here is my query - ...

Tips on utilizing emmet effectively through copy and paste

When I have an emmet snippet like this one: .row>.col>(.row>.col.bg-sucess>br*2)+(.row>.col.bg-danger>br)+(.row>.col.bg-warning*3) and I paste it into my vscode from any source, it doesn't register as an emmet snippet. So I ofte ...

How can I hide or remove the pesky three dots "..." from appearing in any HTML elements?

While working on a project in VueJS, I've noticed that whenever I add a new class to an HTML tag, it displays as class="..." This is something that bothers me, and I'm not sure if it's due to a recent extension I installed or if i ...

The placement of DropLeft is incorrect

I have encountered an issue while designing a navbar with Bootstrap 4. I have placed my links on the right side of the navbar. However, when I add a dropdown to the left side of the navbar, the dropdown appears in the wrong position. Can anyone help me ide ...

The transfer of information through HTTP

I have been exploring the inner workings of HTTP servers and clients to better understand how data is transmitted. Despite reading numerous articles on the topic, I still have some lingering questions that remain unanswered. I would like to walk through th ...

Fixing the Responsive Menu Issues

In order to achieve the desired effect of making the text from menu and logo disappear when minimizing the menu, you can use the following approach: Create a function called `smallNav()` to handle the resizing of the sidebar container: function sm ...

Creating a persistent gap BETWEEN li inline list items

I'm seeking a solution to create horizontal links using a list. I know that I need to apply the display: block property to the ul element and set display: inline for the li items. While there are several inquiries about maintaining a consistent width ...

Loading images with CSS media queries is an essential technique for optimizing

Currently, I am exploring options to dynamically load a background image based on the width of the browser window. This way, I can optimize bandwidth usage by only loading the image that will be displayed. I am aware that using the HTML picture tag allows ...

How come the width factor encompasses the border when the box-sizing is set to content-box?

My HTML file contains the following code: <html lang="en" class=""><head> <meta charset="UTF-8"> <title>CodePen Demo</title> <meta name="robots" content="noindex"> ...

The OK Button Dialogbox is currently malfunctioning

While using jQuery for a dialog box, I encountered an issue when trying to delete an element within it. After clicking the ok button, the dialog box did not redirect or close itself properly. The initial content in the dialog box seems to work fine. < ...

The jQuery window.load() function fails to execute on iOS5 devices

I added a basic loading div to my website that fades out once the entire page has finished loading. The code I used is simple: $(window).load(function(){ $('#loading').fadeOut(500); }); While this works well on all desktop browsers and Chro ...

Establish the directory for javascript and css files following the designated URL rewriting regulations in the .htaccess file

Currently in the process of rewriting my URLs by configuring rules in the .htaccess file. The current version of my .htaccess file looks like this: Options +FollowSymlinks RewriteEngine on AddType text/css .css RewriteRule ^lunettes-collection/([ ...

Implementing JavaScript functionality upon page load with ASP.NET

I have come across a situation where I am trying to integrate working code (jQuery/Javascript) that makes an API call and sends data to it. The API service then responds with a success or failure message based on the data insertion into the API db. Everyth ...

Ways to eliminate hover effect in CSS

I have a text that is currently displayed as a hyperlink, and some CSS code is causing it to underline and become bold when hovered over. I want to remove the hyperlink, but still keep this style by default without needing to hover over the text. Here is m ...

Get the application/pdf document that was just sent to you from the software backend

I am facing an issue with downloading a PDF file sent from the backend. Upon receiving a blob response, I notice that when I download and view the file, the sheets are empty, matching the expected number of sheets. Could this be a coding problem? Current ...

The file-loader in Webpack is failing to copy the files and update the URL

I am encountering an issue with webpack file loader where it is not outputting image files. This problem arises while also importing HTML files as partials in my Angular app. Below is my webpack configuration for handling images using the file-loader: [w ...

Having trouble with CSS background-attachment not functioning properly and unable to adjust padding or margins on the background

Currently, I am in the process of learning CSS and HTML5. However, I am experiencing some difficulty when it comes to implementing basic elements. Specifically, I am using Google Chrome and attempting to create a top bar for my webpage. This top bar should ...