What is the best way to ensure the text in my paragraph div is aligned to the left and displays in a vertical line?

I am struggling to align the words in my paragraph to the left in a straight line, instead of the zig-zag placement they currently have. Any guidance on achieving this would be greatly appreciated.

/* Styling for tablet-sized screen*/

@media (min-width: 769px) {
  #columns {
    -webkit-column-count: 2;
    /* Chrome, Safari, Opera */
    -moz-column-count: 2;
    /* Firefox */
    column-count: 2;
    flex-wrap: no-wrap;
  }
  .main-header h1 {
    justify-content: center;
  }
  .nav {
    flex-direction: row;
    max-width: 350px;
  }
  .nav li {
    border: none;
    background-color: #eff5f5;
    justify-content: center;
  }
  body {
    margin: 2em;
    padding: 0;
  }
  #header-info {
    position: relative;
  }
  .profile-image {
    position: absolute;
    right: 5em;
    height: 200px;
    width: 200px;
  }
  #first-paragraph {
    position: absolute;
    width: 400px;
    height: 300px;
    left: 10%;
  }
  #first-pargaraph p {
    text-align: left;
  }
  #header_info {
    max-height: 400px;
    background-color: #eff5f5;
    margin-top: 0;
  }
<div id="header_info">
  <header class="main-header">
    <h1>Tracy Excell</h1>
    <ul class="nav">
      <li><a id="home">Home</a>
      </li>
      <li><a href="#portfolio">Portfolio</a>
      </li>
      <li><a href="#contact">Contact</a>
      </li>
    </ul>
  </header>

  <div id="wrapper">

    <img src="images/kiwiicon2.jpg" alt="Profile-picture" class="profile-image">

    <div id="first-paragraph">
      <p class="paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing 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 velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
    </div>
  </div>

Answer №1

Have you experimented with the following in your CSS:

text-align: left;

Typically, this aligns text to the left. I haven't had a chance to test your code yet.

Generally, there is no need to encase paragraph tags within divs unless you intend to load dynamic content into that div. If you need to style the paragraph using CSS, you can simply assign an id or a class to the paragraph tag.

Therefore, your CSS should look like this:

.paragraph
{
     text-align: left;
}

Answer №2

To align text on both sides, you can simply use the CSS property text-align: justify:

p {
  text-align: justify;
}

You can see a live example of this code in action here: https://jsfiddle.net/21drwqeq/

Answer №3

Your code has been modified, please review it carefully:

http://jsbin.com/xayefe/edit?html,css,output

Just a reminder: I am utilizing clearfix to establish the parent's height, along with display: table; and display: table-cell; for enabling vertical-align: middle;.

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

Guide to showcasing user input using a Javascript function

I need assistance to show the user input via the submit button. Users will enter tool types and the first five inputs will be displayed in list items (li). Once the limit of 5 tools is reached, a message 'Thanks for your suggestions' should appea ...

Display additional information in a sidebar when hovering over it

I stumbled upon a sidebar code that caught my interest: #sidebar { position: fixed; z-index: 10; left: 0; top: 0; height: 100%; width: 60px; background: #fff; border-right: 1px solid #ddd; text-align: center; } #sidebar a { text-d ...

Guidelines for automating button click using selenium in Python

<div class="wrapper"> <button class="w-full h-14 pt-2 pb-1 px-3 bg-accent text-dark-1 rounded-full md:rounded select-none cursor-pointer md:hover:shadow-big focus:outline-none md:focus:bg-accent-2 md:focus:shadow-small "> ...

What is the process for altering the colors of HTML form elements shown in UIWebView?

My application opens HTML pages in a UIWebView with a specific color theme that gets disrupted by form elements on the page (including "select" fields) which have their own color scheme of white font and light gray background. Despite trying CSS adjustment ...

Is it possible to create .html files using the provided list of words?

Can we create .html files from a word list? Check out the example shown in the attached image. Thank you! View Image ...

Is there a JavaScript function available to remove comments from previously commented HTML code?

<div id="div1">bar</div> JQuery function addComment(element){ element.wrap(function() { return '<!--' + this.outerHTML + '"-->'; }); } addComment($('#div1')); Looking for assistance in unc ...

Sending the JWT header while using Stripe checkout: A step-by-step guide

I am currently working on setting up a webpage using HTML that will later be integrated with Vue.js. My goal is to include a Stripe checkout form/script/button and have the ability to submit the form with a predefined action that will send the data back to ...

Adding a class to an element can be easily achieved when both input fields have values

Is it possible to apply the "active" class to the element go_back_right only when both inputs with classes search_box_name and search_box_id have content in them? I've tried looking for solutions on this platform, but being new to JavaScript, I couldn ...

Updating the contents of one specific div without affecting all other divs with the same class

Below is the HTML code snippet in question: <a class="btn test-btn test-btn-1"> <span>Content 1</span> </a> This particular code block appears multiple times on the page. The number at the end of test-btn- is dynamically generat ...

Setting a static width for a specific cell in HTML5 - What's the best way to go about it?

When working with HTML5, how do I define a specific width for a table cell? Many of the <col> properties that were present in HTML4 are no longer applicable in HTML5. Just to clarify, I am aware that I can use <td style="width:150px">, but thi ...

col-md is taking precedence over col-sm at lower screen resolutions

Col-md takes precedence over col-sm in Bootstrap 4 https://i.sstatic.net/ydL5O.png ...

Delivering seamless css integration using express.js

Lately, I've been struggling with serving CSS using Express.js. After some trial and error, I managed to make it work. However, I'm puzzled as to why my new code works while the old one doesn't. Here's the code that now works for me: co ...

Revamp the hues of numerous elements simultaneously using just a single click!

Is there a way to change the colors of various elements (footer, divs, text) background and text color at once using just one button? I attempted to use JavaScript buttons, but I'd prefer not having to name each individual object's button in orde ...

What is the method to apply a class exclusively to an img tag?

While using the Cycle2 Carousel plugin, I encountered an issue with the class being set for my thumbnails. The plugin sets the .cycle-pager-active class for both images and divs, which is not ideal. I attempted to fix this by adding 'img' before ...

What is the method for identifying the name of a CSS Variable currently in use?

Consider this code snippet: /* css */ :root { --text-color: #666666; } input { color: var(--text-color); } In Javascript, how can I determine the name of the CSS custom property (variable) being utilized? // javascript console.log(document.querySel ...

Eliminate the loading spinner from the tab on Google Chrome

Recently, I've been working on a project to create a website and have been searching for some innovative ideas. One interesting discovery I made was . What caught my eye was the unique feature where clicking on any tab did not result in the typical sp ...

Photo frame edge

I am in the process of creating a basic website using HTML and CSS. My current task involves taking an image and using it as a page border. Unfortunately, I am unable to share my progress at this moment because I am unsure of where to begin. I understand ...

What is the best way to obtain the value of a radio button using ajax?

Here is the search button in my PHP file. I am unsure of how to connect the radio button to the JavaScript file. <button id="submit">Search</button> This is the starting point in the JavaScript file var xhr = new XMLHttpRequest(); f ...

What is the most effective way to showcase PHP Multidimensional Arrays?

Is there a way to utilize the foreach loop in PHP to display this content as a list? I am aiming to present it in a list format. $quantity=0; $quantities = array( array('Jan',($quantity += $ppmpitem->m1)), array ...

Tips for including a close button in a slidedown panel

Having this as a functional slidedown effect: ::-webkit-scrollbar { width: 0px; /* remove scrollbar space */ background: transparent; } /* optional: show position indicator in red */ ::-webkit-scrollbar ...