Is there a way to position the text to the right and the image to the left?

I have written the following code:

<!DOCTYPE html>
<html>

<head>
  <title>UMass Boston Computer Science Club About page</title>
  <link href='https://fonts.googleapis.com/css?family=Chakra Petch' rel='stylesheet'>
  <style>
    .logo-umb {
      height: 100px;
      width: 100px;
      float: left;
    }
    
    .link {
      padding-left: 30px;
      padding-right: 30px;
      padding-top: 80px;
      padding-bottom: 30px;
      border: none;
    }
    
    .link-home,
    .link-about,
    .link-events,
    .link-guests,
    .link-contact {
      font-family: 'Chakra Petch';
      color: #005A8B;
    }
    
    .about-title {
      font-family: 'Chakra Petch';
      color: white;
    }
    
    .about-cs-club {
      background-color: #005A8B;
      float: right;
    }
    
    .university-hall {
      float: left;
    }
    
    .about-p {
      font-family: 'Chakra Petch';
      color: white;
      float: right;
    }
    
    .abouttext {
      float: right;
    }
    
    th,
    td {
      padding-left: 15px;
      padding-right: 15px;
      padding-top: 10px;
      padding-bottom: 10px;
    }
    
    .Address {
      font-family: 'Chakra Petch';
      color: #005A8B;
    }
    
    .links {
      top: 100px;
    }
  </style>
</head>

<body>
  <div class="Logo">
    <img src="https://scontent-bos3-1.xx.fbcdn.net/v/t39.30808-6/275365687_1556735314708607_360968714522368993_n.jpg?stp=dst-jpg_s1080x2048&_nc_cat=108&ccb=1-5&_nc_sid=730e14&_nc_ohc=XIlEE10wTp8AX_QciOa&_nc_ht=scon...
      class="logo-umb">
  </div>
  <div class="links">
    <table>
      <tr>
        <td class="link"><a class="link-home">HOME</a></td>
        <td class="link"><a class="link-about">ABOUT</a></td>
        <td class="link"><a class="link-events">EVENTS</a></td>
        <td class="link"><a class="link-guests">GUESTS</a></td>
        <td class="link"><a class="link-contact">CONTACT US</a></td>
      </tr>
    </table>
  </div>
  <div class="about-cs-club">
    <div class="university-hall">
      <img src="https://hga.com/wp-content/uploads/2019/08/University-of-Massachusetts-Boston-%E2%80%93-University-Hall-interior-lobby-1.jpg" width="600" height="400">
    </div>
    <div class="abouttext">
      <h1 class="about-title">What is the UMass Boston Computer Science club?</h1>
      <p class="about-p">For motivated students who are interested in computer science and technology and attend UMass Boston, this student run computer science club is right for you. Taking place at the University Hall Room 4140 between 3:00-4:00 pm on Mondays, the computer
        science club at UMass Boston is conveniently located in one of the newest and sexiest buildings at UMass Boston, and since anybody can attend the computer science club, when you attend the CS Club, you can learn everything, from web design to
        app development to learning extra programming languages such as HTML, Java, JavaScript, Python, and Swift, and even, learning about operating systems and the history of computers as well. So everybody, come and join this CS Club. We plan events,
        run competitions and competition training, share knowledge, and run excursions.</p>
    </div>
  </div>
  <p class="Address">
    University of Massachusetts Boston
    <br> 100 Morrissey Blvd.
    <br> Boston, MA 02125-3393
    <br> 617.287.5000
  </p>
</body>

</html>

However, I am facing an issue where the text appears on the right while the image is displayed on the left side. I require assistance to modify it so that the image aligns to the left and the paragraph content is shown on the right. Is there a method to merge these two elements successfully, ensuring the paragraph content displays on the right-hand side of the webpage next to the image? Despite attempting various solutions, I have been unsuccessful in achieving the desired layout.

Answer №1

To implement a flexible layout for the CS Club section, you can use .about-cs-club{ display: flex;} and .about p{ margin: 1rem 1rem 0;}. For styling the headings in the about section, apply .abouttext h1{ margin-left: 1rem;}

.logo-umb {
    height: 100px;
    width: 100px;
    float: left;
}
.link {
    padding-left: 30px;
    padding-right: 30px;
    padding-top: 80px;
    padding-bottom: 30px;
    border: none;
}
.link-home, .link-about, .link-events, .link-guests, .link-contact {
    font-family: 'Chakra Petch';
    color: #005A8B;
}
.about-title {
    font-family: 'Chakra Petch';
    color: white;
}
.about-cs-club {
    display: flex;
    background-color: #005A8B;
    float: right;
}
.university-hall {
    float: left;

}
.about-p {
    font-family: 'Chakra Petch';
    color: white;
    float: right;
    margin: 0 1rem;
}
.abouttext {
    float: right;
}
.abouttext h1{
    margin-left: 1rem;
}
th, td {
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 10px;
    padding-bottom: 10px;
}
.Address {
    font-family: 'Chakra Petch';
    color: #005A8B;
}
.links {
    top: 100px;
}
<div class="Logo">
    <img src="https://scontent-bos3-1.xx.fbcdn.net/v/t39.30808-6/275365687_1556735314708607_360968714522368993_n.jpg?stp=dst-jpg_s1080x2048&_nc_cat=108&ccb=1-5&_nc_sid=730e14&_nc_ohc=XIlEE10wTp8AX_QciOa&_nc_ht=scontent-bos3-1.xx&oh=00_AT-k3_5tH_E0qLKbssSfMKsHl9M7srtmIoECCQR1ZV5okQ&oe=622BBB6A" class="logo-umb">
  </div>
  <div class="links">
    <table>
        <tr>
            <td class="link"><a class="link-home">HOME</a></td>
            <td class="link"><a class="link-about">ABOUT</a></td>
            <td class="link"><a class="link-events">EVENTS</a></td>
            <td class="link"><a class="link-guests">GUESTS</a></td>
            <td class="link"><a class="link-contact">CONTACT US</a></td>
        </tr>
    </table>
  </div>
  <div class ="about-cs-club">
    <div class="university-hall">
        <img src="https://hga.com/wp-content/uploads/2019/08/University-of-Massachusetts-Boston-%E2%80%93-University-Hall-interior-lobby-1.jpg" width="600" height="400">
    </div>
    <div class="abouttext"><h1 class="about-title">What is the UMass Boston Computer Science club?</h1>
    <p class="about-p">For motivated students who are interested in computer science and technology and attend UMass Boston, this student run
         computer science club is right for you. Taking place at the University Hall Room 4140 between 3:00-4:00 pm on Mondays, the computer science 
         club at UMass Boston is conveniently located in one of the newest and sexiest buildings at UMass Boston, and since anybody can attend the 
         computer science club, when you attend the CS Club, you can learn everything, from web design to app development to learning extra programming 
         languages such as HTML, Java, JavaScript, Python, and Swift, and even, learning about operating systems and the history of computers as well. 
         So everybody, come and join this CS Club. We plan events, run competitions and competition training, share knowledge, and run excursions.</p>
        </div>
    </div>
  <p class="Address">
    University of Massachusetts Boston
    <br>
    100 Morrissey Blvd.
    <br>
    Boston, MA 02125-3393
    <br>
    617.287.5000
  </p>

Answer №2

To make the design more responsive, simply include display:flex in the about-cs-club stylesheet.

Answer №3

Utilizing flex would be a great option. However, if you prefer to personalize your code further, consider incorporating it into the .abouttext class with a width of 50%

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

The function mysql_fetch_assoc is displaying absolutely nothing (neither null, nor 0, nor an empty string)

I'm encountering an issue with retrieving data from my $result variable. Everything works smoothly when there is one result, but if I try to check for a result and find none, the $array ends up empty. Running both commands below results in nothing bei ...

What is the best method for combining several variables into a single one using a parameter?

On the webpage, there is a table containing 11 checkboxes. I am looking to create a keyword that allows testers to input just 1, 2, or 3 to select a specific checkbox without needing multiple lines of element variables. Here are the elements: xpath=(//in ...

What is the process for adding a box shadow beneath my header?

I am currently attempting to add a box shadow under my header, similar to the design featured in the project mockup at https://github.com/RaghavMangrola/the-brighton-times. After trying to implement the following CSS property and value: .header { ...

How can I align the kendoMenu in the center when the menu width is unpredictable?

Presenting a modified menu structure: <html class="k-webkit k-webkit40"> <head> <title>Site Title</title> <!-- js and css files referenced here --> </head> <body> <link h ...

Tips for effectively documenting CSS on a extensive website

Our website is quite extensive, with numerous pages. As we've added more pages, the amount of HTML and CSS has also increased. We're wondering if there's an efficient way to document all of this information. For example, how can we easily de ...

Creating a square shape in Twitter Bootstrap to frame an item on a webpage

I've been working on creating a webpage that looks similar to the image provided. I've managed to get about 90% of it done, but there are a couple of issues I'm facing: How can I create a square with a triangle at the bottom as shown in th ...

What is the method for writing to an HTML file with the use of expressjs?

Alright, I have an interesting idea here. I am looking for a way to allow users to push a button and have a new p element permanently added to the HTML file. This means that even after reloading the page, everyone should be able to see this new element. An ...

Leverage CSS styling for database values within a PHP framework

How can I style MYSQL database values in HTML using CSS? My vegetarian database row has 'Y' for yes and 'N' for no. I want to apply different styles to these values using CSS as I display them on my PHP-based page. if ($result1->num_ ...

Rearrange the li elements within multiple ul lists using JavaScript

Is there a way to reorder multiple ul-lists on my website using JavaScript? An example of the lists may be as follows: $(document).ready(function() { var ul = $('ul.filelist'); for (let u = 0; u < ul.length; u++) { const element = ul[ ...

Issue with GridLayout causing rows to be misaligned

As a newcomer to the world of CSS, I found myself in need of a grid layout for a quick project. Here's the mishmash of CSS code I came up with: body { margin: 40px; } .container { display: grid; grid-template-rows: [row1start] 20% [row2sta ...

Utilizing Element IDs for JQuery Tab Implementation

Having two buttons and two divs with paragraphs, I want to create tabs without adding new classes or IDs. Can I achieve tab switching using the existing IDs that end with "_one"? For instance: The first button has the ID "tab_button_one" and the first di ...

The ng-controller (dropdown menu) is functioning properly when tested locally and on JSFiddle, however, it is not working on

My HTML website with ng-app is functioning properly when tested locally and on certain coding platforms like JSFiddle and CodePen. However, it seems to encounter issues when deployed on Google Sites, Github, W3, and similar websites. The main functionalit ...

Designing a structure with three fieldset components

I'm currently trying to design a page layout that includes three fieldsets. My goal is to have the first one span across 100% of the width, with the other two positioned side by side below it at 50% width each. However, I am struggling to achieve thi ...

Unable to enclose a table within a div element for Chrome web browser

I attempted to keep a table within a div to ensure that the table's width does not go beyond the width of the containing DIV. This table consists of one row with two elements. The second element is fixed in length, while I want the first element to w ...

The conversion of string to number is not getting displayed correctly when using console.log or document.write. Additionally, the concatenated display is also not functioning as intended

Being new to JS and HTML, this program was created to enhance my understanding of the concepts. I attempted a basic program to convert a string to a number in three different ways, but I am having trouble determining if the conversion actually took place. ...

Tips for creating two interchangeable lists and saving the selected items when the selection process is finished

Utilizing jQuery and specifying dual selectors together, I attempt to reference each variable in the following code: UL_HeadersToOmit - represents the list to select from UL_dropedCols - indicates the list to be passed as a reference to the subsequent fu ...

I find it confusing how certain styles are applied, while others are not

Working on my portfolio website and almost done, but running into issues with Tailwind CSS. Applied styling works mostly, but some disappear at certain breakpoints without explanation. It's mainly affecting overflow effects, hover states, and list sty ...

Display or conceal content based on checkbox status

i am trying to create a system where content is hidden by default and only displayed when a checkbox is checked. The goal is to show the content when the checkbox is checked and hide it when unchecked, so that other content can be shown as well upon checki ...

Craft a Flawlessly Repeating Sound Experience - Online

I'm facing a challenge in creating a flawless loop of an audio file. However, all the methods I've tried so far have resulted in a noticeable gap between the end and the start. Here are the approaches I experimented with: The first approach inv ...

The calculator is experiencing issues with JavaScript functionality

Having some trouble developing a calculator using HTML5, CSS, and JavaScript. After passing my HTML and CSS through validators successfully, I encountered issues when adding JavaScript functions to enable the functionality of the buttons on the calculator. ...