Strange and unexpected dots appearing in my dynamic timeline

After finding a responsive timeline on codepen, I decided to use it for my website because creating one from scratch seemed like too much effort. I made some modifications to fit my needs, but there's one irritating issue that I can't seem to get rid of - a floating period in the left column on the last line of a paragraph. Check out the screenshot

Could this be a CSS problem? Feel free to run the code snippet and see the issue for yourself.

I really want to eliminate this pesky little problem so that it doesn't confuse readers who visit my website.

Yes, it is indeed a period. Refer to the second screenshot for clarity

https://i.sstatic.net/zAnd0.jpg

https://i.sstatic.net/llWCl.jpg

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  outline: none;
}

body {
  margin: 0;
  padding: 30px 0;
  font-family: 'Roboto', sans-serif;
  background: #F1F2F6;
}

h1 {
  text-align: center;
  font-weight: 300;
  color: #777
}

h1 span {
  font-weight: 600;
}

.container {
  width: 80%;
  padding: 50px 0;
  margin: 50px auto;
  position: relative;
  overflow: hidden;
}

.container:before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -1px;
  width: 2px;
  height: 100%;
  background: #CCD1D9;
  z-index: 1
}

.timeline-block {
  width: -webkit-calc(50% + 8px);
  width: -moz-calc(50% + 8px);
  width: calc(50% + 8px);
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  -moz-box-pack: justify;
  justify-content: space-between;
  clear: both;
}

.timeline-block-right {
  float: right;
}

.timeline-block-left {
  float: left;
  direction: rtl
}

.marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #F5F7FA;
  background: #4FC1E9;
  margin-top: 10px;
  z-index: 9999
}

.timeline-content {
  width: 95%;
  padding: 0 15px;
  color: #666
}

.timeline-content h3 {
  margin-top: 5px;
  margin-bottom: 5px;
  font-size: 25px;
  font-weight: 500
}

.timeline-content span {
  font-size: 15px;
  color: #a4a4a4;
}

.timeline-content p {
  font-size: 14px;
  line-height: 1.5em;
  word-spacing: 1px;
  color: #888;
}

@media screen and (max-width: 768px) {
  .container:before {
    left: 8px;
    width: 2px;
  }
  .timeline-block {
    width: 100%;
    margin-bottom: 30px;
  }
  .timeline-block-right {
    float: none;
  }
  .timeline-block-left {
    float: none;
    direction: ltr;
  }
}
<h1>Pure Css responsive <span>timeline</span></h1>

<div class="container">

  <div class="timeline-block timeline-block-right">
    <div class="marker"></div>
    <div class="timeline-content">
      <h3>First Year</h3>
      <span>Some work experience</span>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
        dolor in reprehenderit in voluptate.</p>
    </div>
  </div>

  <div class="timeline-block timeline-block-left">
    <div class="marker"></div>
    <div class="timeline-content">
      <h3>Second Year</h3>
      <span>Some work experience</span>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
        dolor in reprehenderit in voluptate.</p>
    </div>
  </div>

  <div class="timeline-block timeline-block-right">
    <div class="marker"></div>
    <div class="timeline-content">
      <h3>Third Year</h3>
      <span>Some work experience</span>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
        dolor in reprehenderit in voluptate.</p>
    </div>
  </div>

  <div class="timeline-block timeline-block-left">
    <div class="marker"></div>
    <div class="timeline-content">
      <h3>Fourth Year</h3>
      <span>Some work experience</span>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
        dolor in reprehenderit in voluptate.</p>
    </div>
  </div>

  <div class="timeline-block timeline-block-right">
    <div class="marker"></div>
    <div class="timeline-content">
      <h3>Fifth Year</h3>
      <span>Some work experience</span>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
        dolor in reprehenderit in voluptate.</p>
    </div>
  </div>
</div>

Answer №1

Remove the "direction: rtl;" property from the timeline-block-left class and add "text-align:justify" as shown below:

.timeline-block-left {
  float: left;
  text-align: justify;
}

Answer №2

When it comes to flipping content on larger screens using JavaScript, the common approach is to add direction: rtl;. However, this may not be the most effective method as it essentially changes the reading direction to Right to Left, causing punctuation to appear at the semantic "end of the line".

An alternative solution would be:

.timeline-block-left {
    float: left;
    text-align: right;
}

Additionally, you will need to manually adjust the position of the blue circle in the line.

Answer №3

The dot is appearing because of the direction: rtl; property applied to your p element. This property should only be used for languages that are written from right to left.

Here are a few ways to fix this:

Using text-align

You can use the text-align property to align your paragraph instead of using the direction property.

Add the following code to your CSS, and the dot will appear on the right side:

.timeline-block-left .timeline-content p {
  text-align: right;
  direction: ltr;
}

@media screen and (max-width: 768px) {
  .timeline-block-left .timeline-content p {
    text-align: left;
  }
}

Using &lrm; character

You can also use the &lrm; character in right-to-left text to force punctuation to display on the right side. Here's an example:

<div class="timeline-block timeline-block-left">
  <div class="marker"></div>
  <div class="timeline-content">
    <h3>Seconed Year</h3>
    <span>Some work experience</span>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
      dolor in reprehenderit in voluptate.&lrm;</p>
  </div>
</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

Is it possible to overlay two divs on top of a current website layout?

I am currently attempting to overlay two divs on top of an established website, similar to the layout shown in the image: While I am able to achieve this successfully in browsers like Firefox and Google Chrome, I am encountering difficulties when trying t ...

Having trouble updating attribute through ajax requests

How can I set attribute values using ajax-jquery? Here are some snippets of code: HTML_CODE ========================================================================== <div class="col"> <ul class="nav nav-pills justify-content-end& ...

Tips for modifying the default settings of a CSS framework like Material UI

Exploring the realm of CSS for the first time and feeling a bit lost. I am working with material ui alongside react and redux. My goal is to customize certain properties of a specific component, such as TextField with the disabled attribute. Upon inspectin ...

Struggling to minimize the dimensions of the Image div in React Js with Tailwind CSS

I am currently working on replicating the functionality of the Book My show Application. Specifically, I am developing a Cast and Crew slider. Despite my efforts to decrease the size of the images, the spacing between them remains unchanged. Here is my Ja ...

Iterate over div elements using jQuery

I am experimenting with creating a jQuery slider using divs: <div id="block-1"> <div id="bannerleft"> <div class="wsite-header-1"></div> </div> <div id="bannerright"> < ...

Ensure that the text panel is properly aligned directly under the logo

I need help achieving a layout similar to the image linked below: https://i.sstatic.net/GTOJF.jpg In my design, the red box represents my company logo with some text hidden. However, in my attempt shown in the second image here: https://i.sstatic.net/7xY ...

CSS - Update BackgroundColor Depending on Child Element Color

Is there an official CSS way to change the background color based on the child element in HEX? For example: render() { return ( ... <span> <h3 style={{ color: item.color }}>Item Color</h3> </span> ...

"Troubleshooting jQuery html() Function Issue in Firefox: Dealing with an Unterminated

Trying to insert the following string into a <p> element: (without specified charset) Цена: 4,80 BGN Поддръжка: (directly from .XML file) &#1062;&#1077;&#1085;&#1072;: 4,80 BGN Encountering ...

The conundrum with JQuery: My script refuses to run when a variable is defined

<script> $(document).foundation( let total = 1 $("button.test").click(function(){ if ($("p.change-me").text() === "OFF") { $("p.change-me").text("ON") total = total + 1 } ...

"Eliminate any inline styling from a string element with the power of JavaScript/j

If I have the following string: let sentence = '<h1 style="lots of class"> </h1><h2> <p style="bunch of class"> </p> <p style="bunch of class"> </p></h2>'; This string contains multiple elements a ...

Modify Vuetify's border autocomplete styling

Currently, I have vuetify 1.5.x set up on my codepen. Upon reviewing my codepen, I noticed that the line displayed on the autocomplete feature appears to be quite thick. My goal is to have that line be only 1px. For the select field (outline border), I int ...

What is the best way to ensure that text only displays up to five lines and fully collapses using CSS or javascript/jquery?

Hello everyone, I have come across an issue. English is not my strong suit, but I will do my best to explain it thoroughly. The problem at hand is a design requirement in the draft that specifies showing up to five lines of text. If the text exceeds this ...

Is there a way to align the image block-grid from left to right?

Is there a way to change the alignment of images in the x-block-grid four-up class to be RTL on this page? () I have managed to make the h2 tag RTL using the following code: <h2 class="h-custom-headline h5 accent" dir="rtl"><span>Code</spa ...

Event fails to trigger when attached to different elements

Currently, I have an onchange event linked to the input text box and an onclick event attached to a text link. Interestingly, when I click on the link after editing the textbox, the click event does not trigger - instead, the change event is fired. If you ...

Issues with a top navigation bar

I'm currently working on customizing a header menu to my liking but have limited experience with CSS. The header menu consists of two main items, each with a dropdown. I envision the first menu item to look like this upon hover: https://i.sstatic.net ...

Is there a way to make text in a table header scroll vertically?

I am facing an issue with a table displaying vertical text in the header. Here is a simplified example: FIDDLE HTML & CSS div.vertical { margin-left: -100px; position: absolute; width: 215px; transform: rotate(-90deg); -webkit-transform: ...

I'm puzzled as to why the root-relative link is not functioning

One challenge I am facing in improving the portability of my web app is creating root-relative links within a sub-directory. /website - This is the main directory for my website. /inc - Here lies the includes directory housing header, footer, and po ...

What measures can be taken to prevent content from collapsing?

My goal is to create a navigation system using Bootstrap 4's collapse feature to display content based on buttons at the top of the page. Here is my navigation bar setup: <div class="port-item p-4 bg-primary" data-toggle="collapse" data-target="# ...

"Step-by-step guide on creating a web app with a transparent background while simultaneously running other processes

Would love to create a web application for real-time debugging similar to "android->developer options->show touch data" or "android->developer options->show CPU usage". Unfortunately, I have not been able to find a suitable method using HTML5 ( ...

The pie chart generated by Google may be small in size, but it certainly packs

Below, you will find my page layout created using Bootstrap 4 and Google Charts. The layout consists of three black boxes, with the one on the right displaying a Google pie chart. However, I'm facing an issue where the area allocated for the chart is ...