What is the technique for ensuring that text is aligned to the left with a line break?

I am facing an issue with a <td> element nested inside a <p>. The problem arises when the text exceeds the maximum length, causing the overflow text to be printed on a new line from right to left.https://i.sstatic.net/lI3bm.png

How can I resolve this and ensure that the new line starts printing from right to left? Below is the code snippet in question:

.group {
  border: 2px solid #FFCC00;
  min-width: 250px;
  width: 32.85%;
  margin-bottom: 5px;
  margin-left: 5px;
  padding: 3px;
  float: left;
}

.group article {
  padding: 5px;
  max-height: 350px;
  overflow: auto;
}

.group article table {
  width: 100%;
  border-spacing: 7px;
}
<div class="group">
  <article>
    <header> Links</header>
    <hr/>
    <section>
      <table>
        <tbody>
          <tr>
            <td>
              <p><a href="example.com/" target="_blank">Click here</a></p>
            </td>
            <td>
              <p>Description </p>
            </td>
          </tr>
        </tbody>
      </table>
    </section>
  </article>
</div>

Answer №1

By applying the following CSS:

text-align: right;

You can align text to the right side, just like in your example.

.group {
  border: 2px solid #FFCC00;
  min-width: 250px;
  width: 32.85%;
  margin-bottom: 5px;
  margin-left: 5px;
  padding: 3px;
  float: left;
}

.group article {
  padding: 5px;
  max-height: 350px;
  overflow: auto;
}

.group article table {
  width: 100%;
  border-spacing: 7px;
}

td.right p{
  text-align:right;
}
<div class="group">
  <article>
    <header> Links</header>
    <hr/>
    <section>
      <table>
        <tbody>
          <tr>
            <td>
              <p><a href="example.com/" target="_blank">Click here</a></p>
            </td>
            <td class="right">
              <p>Description lorem ipsum dollar sit amet</p>
            </td>
          </tr>
        </tbody>
      </table>
    </section>
  </article>
</div>

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

Mobile live server displaying navbar outside viewport limits

I've encountered a strange issue with my website at . The navbar is extending beyond the viewport on mobile when using the live server. However, everything works fine on localhost. This problem only occurs on the "/" route; other routes display corr ...

Changing the arrow in jQuery's slideToggle for different div elements is a breeze

Good day, I'm struggling with getting the arrow switch to work correctly for slideToggle. Even though I have three of them, the arrow changes only for the first one - no matter which div I click on. Any suggestions on what I might be missing? Thank yo ...

Laravel - Oops! The requested page could not be found for the HTML POST Form

I am currently developing a web application with Laravel that allows users to add new products to a MySQL database using an HTML form. However, I am facing an issue where upon clicking "Add product," it displays the following error: HTML Form <form a ...

jQuery's animation feature is experiencing significant delays when triggered by scrolling

Is there a way to make an image appear and disappear as the user scrolls by using the .animate() method? I have attempted to implement it, but unfortunately, it seems quite slow and sometimes the image does not reappear when scrolling back to the top. Take ...

The text-transform property in Css is not functioning as expected

Can anyone explain to me why the text-transform: none property is not working on my div? Any ideas? HTML <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <link href='https://fonts.googleapis.com/css?f ...

Tips for initiating a function at a designated scroll point on a webpage

Currently, I am testing out a code snippet that allows images to flip through in a canvas element. I'm curious if it's possible to delay the image flipping effect until the viewer scrolls down to a specific section of the page where the canvas i ...

Creating a Full-Width Slider in WordPress using Metaslider

After deactivating the blog section and sidebars in the fantastic Terrifico theme on my Wordpress site, I am struggling to find a way to add a full width slider. You can see how the theme currently looks here: The content is all enclosed within a box (ma ...

Adjust the CSS styling to ensure that the div or iframe expands to fit the entire height of the

Having trouble making a map embedded via an iframe on a WordPress page display responsively at full height independent of the device? Check out: . To clarify, by full height, I mean that the bottom of the map should not extend beyond the screen, eliminati ...

Can you have two onclick events triggered by a single Div? (ASP.NET / HTML)

I am currently working with Div's and facing a challenge of handling 2 events with just one Div-Click.. I wanted to use both onclick="" and OnClientClick, but it seems that when using a Div, I cannot make use of OnClientClick. Can anyone provide me ...

Printing issues in Chrome cause table headers and footers to display incorrectly in tables with thead and t

Currently, I am utilizing puppeteer for generating PDFs on a Linux Alpine system. To achieve proper headers and footers on each page, I am employing the thead, tbody, tfoot trick. An anomaly caught my attention in how Chrome and Chromium handle layout whi ...

Icon that can be clicked in a div container

Is there a way to prevent the div click event from being triggered when clicking on ion-icon? <div(click)="goNext()"> <ion-icon name="close-circle-outline" size="large" (click)="dissmiss()"></io ...

Code utilizing the url_for method to reference a Stylesheet image located in a neighboring directory

I'm in the process of creating a website with Flask using Python 3.9, and I have the following directory structure: environment/ main.py app.yaml requirements.txt Templates/ base.html #base template index.html ...

Freeze backdrop - remain stationary while sections enlarge

My webpage has a split background - blue at the top and white at the bottom. Here is the CSS style I am using to achieve this: //accordion - changes colour on open / close var selectIds = $('#panel1,#panel2,#panel3'); $(function($) { selectId ...

How to dismiss a JavaScript alert without refreshing the page in Codeigniter 3

I am currently working on building a form with validation using both JavaScript and Codeigniter 3.04. Here is the HTML code for my form: <form class="form-horizontal" method="POST" onsubmit="check()"> //code </form> My goal is to validate t ...

Including a specific item from a list into a fresh list entry

Is there a way to move the selected list item by clicking a button and transfer it to a new list entry? <pre className="reverse-list"> {datas.map((data, i) => <li key={i} className="list-group-item text-capitalize d-flex justify-con ...

Aligning the Navigation icons on my webpage

<nav> <ul> <li><a href="index.php">Home</a></li> <li><a href="index.php?about">About</a></li> <li><a href="index.php?products">Products</ ...

The smooth transition of my collapsible item is compromised when closing, causing the bottom border to abruptly jump to the top

Recently, I implemented a collapsible feature using React and it's functioning well. However, one issue I encountered is that when the collapsible div closes, it doesn't smoothly collapse with the border bottom moving up as smoothly as it opens. ...

JQuery calculator experiencing issues with data-numbers functionality| Troubleshooting allclear button functionality

Need help with AC button functionality and deleting button I am currently working on creating a calculator from scratch using Jquery. However, I am facing difficulties getting the calculate function to work. Despite my attempts at experimenting with javas ...

What steps can I take to improve the smoothness of my Slick slider and ensure it functions correctly across all screen widths

I have been experimenting with a carousel slider using Slick Carousel (). My goal is to make it loop infinitely and function smoothly at different browser widths without the cards stacking, but it's not quite working as intended yet. Currently, there ...

Ways to automatically choose an option based on the value of another dropdown?

I need help with a dynamic dropdown feature. Essentially, I have three dropdown menus and I want the third one to update based on the selections made in the first two. For example, if "M" and "Red" are selected in the first two dropdowns, then the third dr ...