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

Several buttons, each requiring to show distinct text

Currently, I am attempting to enhance an existing project that was graciously created for me. I must admit, I am quite new to this, so please be patient with me! In my project, there are 9 buttons, each triggering the display of a different image upon bei ...

Personalize the layout for vertical table headings and table information

I need help with a table that has vertical headers. I want to remove the extra space within the table header and data cells. Here is the code for my table: <table> <tr> <th class="field">Item ID Number:</th> < ...

Expand or collapse Angular Material Accordion depending on selected Radio button choice

Is it possible to use a mat-accordion with radio buttons where each panel expands only when its corresponding radio button is selected? I have the radio buttons functioning correctly, but the panels are expanding and collapsing with every click rather than ...

Styling the content within Template Strings is not supported by VSCode

Recently, I've noticed that there are two scenarios in which my VSCode doesn't properly style the content within my template strings. One is when I'm writing CSS in a JavaScript file, and the other is when I'm fetching data from GraphQL ...

Tips for updating the value of an input text field in one HTML table according to a certain value entered in a different input text field located in another HTML table

I am working with an HTML table that consists of one row. Within this row, there are two TDs which each hold their own tables (each containing 10 rows with 10 input fields). My goal is to update the value of another corresponding text field based on change ...

Adding external JSON data to a plain HTML document can be achieved through the process of

I have been experimenting with extracting data from an API in JSON format, but I am struggling to figure out how to convert the JSON tags into HTML elements. You can view a sample of the JSON data here. Does anyone know how to transform this JSON into DI ...

Using JQuery to conceal floated divs

I'm facing an issue that I had resolved the last time I worked on this website. However, I am currently redesigning it to include additional elements, and I am struggling to make the jQuery part function correctly. Essentially, I have an HTML documen ...

The font-family CSS properties inheritance is not functioning as I had anticipated

I'm currently working on a webpage where I want to add a list of links that resemble tabs. While this style is functioning correctly for the main pages, I'm having trouble implementing it for a new section. The existing list is located within: ...

Tips for creating line breaks in Google Chart tooltips

I'm having trouble breaking a line in the code snippet below. Here is the complete code: <html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script ...

Tips for achieving a static background image while allowing scrolling on a webpage in asp.net

I am struggling to implement this on my website. The background image needs to be fixed while the content of the webpage should scroll in asp.net <head runat="server"> <title></title> <style type="text/css"> body { backgr ...

Discover the sleek and modern concept of transparency in Microsoft's

I'm interested in incorporating Microsoft Fluent Design transparency into my webpage. Are there any CSS or other tools that can help achieve this design language? I want to enhance the look of my site with these elements. ...

Launching a HTML hyperlink inside a div with the power of jQuery

I am currently exploring the functionality of dragging and dropping an HTML link into a div element. My objective is to have the link open within that specific div element. The layout consists of two divisions named "left-panel" and "canvas". The concept ...

retrieve the position of a descendant element in relation to its ancestor element

I'm encountering a challenge while attempting to solve this issue. I have elements representing a child, parent, and grandparent. My goal is to determine the offset position of the child (positioned absolutely) in relation to the grandparent. However, ...

Triggering transitionend event once with an added if condition

Currently, I have an application of an if statement that examines whether an element contains a style attribute. In the event that the style attribute is absent, it appends inline styling. Conversely, if the style attribute exists, it is removed. Furthermo ...

Having trouble with your jQuery animation on a div?

Check out this jsFiddle example: http://jsfiddle.net/uM68j/ After clicking on one of the links in the demo, the bar is supposed to smoothly slide to the top. However, instead of animating, it immediately jumps to the top. How can I modify the code to ac ...

The image displays successfully on desktop, however, it fails to load once the website is deployed on GitHub or Netlify

While developing this website on my Mac, I encountered an issue where images load fine when I copy the project path from Atom to Chrome. However, once I push the same code to GitHub and then publish it on Netlify, the image fails to load. Does anyone kno ...

What is causing my Bootstrap Controls to malfunction?

I'm trying to create a Bootstrap carousel that shows 3 items at once and includes controls to switch between them. The carousel I've made does display the three items, but for some reason, the controls are not responding when clicked. I'm un ...

What steps do I need to take in order to ensure that each webpage displays unique thumbnails?

As a newcomer to website development, I recently looked into implementing open graph on my site. However, I ran into an issue where I could only set one thumbnail for the entire website. This posed a problem as I wanted each navigation menu tab (Home, Abou ...

Apply CSS styles to the checkbox

I am new to CSS and I need help styling a checkbox element. When the user selects one of the checkboxes, I want the background color to change to yellow. Thank you for any assistance you can provide! .radio_toggle { float:left; } .radio_toggle label ...

What is the best way to determine the width and height of text within a TextArea using JavaScript in an HTML document

Imagine this scenario: https://i.stack.imgur.com/cliKE.png I am looking to determine the size of the red box within the textarea. Specifically, I want to measure the dimensions of the text itself, not the dimensions of the entire textarea. The HTML code ...