Newbie struggling with div and css issues

After making changes to my code based on the suggestions below, the layout of the images and text appears to be all over the place. Some elements are behind the div background while others are in front. Additionally, some text is positioned to the left while some is on the right.

I have captured screenshots to illustrate the issue and provided the requested HTML output below:

Desired look: https://i.sstatic.net/8O9uM.png
Current appearance: https://i.sstatic.net/4GUfi.png

------------------------------
HTML Output:

<div class="ind"><a href='127.0.0.1/forsale/105322_24718166' class='left'><img src='http://127.0.0.1/vebra/assets/105322_24718166_IMG_00.jpg' width='296px'></a><br /><h3>Wrexham</h3><p class="area">2 Bedroom property in LL11</p><div class="bottom"><div class="des"><p>Situated close to Wrexham town centre, this two bedroom mid terrace has gas central heating and double glazing and provi.....</p><ul id="info"><li><img src='127.0.0.1/vebra/assets/icons/money_icon.png'><span>£105000</span></li><li><img src='127.0.0.1/vebra/assets/icons/bed_icon.png'><span>2 Bedrooms</span></li><li><img src='127.0.0.1/vebra/assets/icons/area_icon.png'><span>LL11</span></li></ul><h3><br><br><a href='127.0.0.1/forsale/105322_24718166'>View Property Details</a></h3></div></div></div>
------------------------------
PHP Code:

// PHP code here....

------------------------------
CSS Code:

/* CSS styles here.... */

-------------------

Previous Post Below

The PHP script successfully retrieves data from the database, but I'm facing difficulty in aligning the text next to the image as shown in the diagram below:

------------------
- pic      text  -
- left     right -
------------------
-          text      
-         showing     
-          here     

If someone with a fresh perspective could review the code, it would be greatly appreciated.

Answer №1

Experiment with positioning your image using float: left; and your text using float: right;

Answer №2

If you're referring to the image at the top, a simple float: left; should work.

To do this, assign a class to the image or its link, such as class="left":

echo "<a class="left" href='127.0.0.1/forsale/?sale=".$row['AGENT_REF']."'><img src='127.0.0.1/vebra/assets/".$row['MEDIA_IMAGE_02']."' width='296px'></a><br />"; // home image and  link

Then, in your CSS, float it as follows:

.left {
    float: left;
}

Take a look at this example on jsfiddle to get an idea of what you're trying to achieve.

Answer №3

Can you attempt to eliminate the float:left from the following code snippet?

#sale_results .sale_content ul#info li span { font-size: 14px; font-weight: bold; color: #3B3E40; line-height: 24px; float: left; }

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

Discover the name of a color using its HEX code or RGB values

Is there a way to retrieve the color name from RBG or HEX code using JavaScript or JQuery? Take for instance: Color Name RGB black #000000 white #FFFFFF red #FF0000 green #008000 ...

Having trouble getting the Pokemon modal to show both the type and image?

HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>My First JS App</title> <lin ...

Is there a way to include an optional backslash in URLs using the .htaccess file without leading browsers to believe I am navigating to a subfolder?

As I update my php pages with the .htaccess file, I am facing an issue where the pages do not load properly when an optional backslash ("/") is included in the URLs. One possible solution is to use absolute URLs instead of relative ones so that CSS and J ...

The link element could not be found

Having trouble finding the 'Search' link, and encountering the error message: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"link text","selector":"Search"} Upon inspecting the object using Firebug: < ...

Shifting the image below the text for mobile display

My goal is to place an image below a block of text when viewed on a mobile device, but currently, the image is covering the text. Here is how it appears on desktop: [![enter image description here][1]][1] This is the current mobile view (the image is ov ...

Using Flexbox for laying out content in both columns and rows

Hey there, I'm looking for a little help. It's been quite some time since I last built a website from scratch and I want to keep things simple this time around. I've used breakpoints before, but I'm curious if Flexbox could be a better ...

Tips for customizing the appearance of a chosen radio button

Here is my HTML code snippet: <div class="col-md-12 money-radio-container"> <input type="radio" name="optradio" class="money-radio" value="10">10 <span>$</span> <input type="radio" name="optradio" class="money-radio" val ...

The sidebar is misaligned, not following the left alignment set by Bootstrap

While experimenting with Bootstrap, I encountered an issue where an element in the sidebar remains at the bottom instead of aligning to the right as intended. https://i.sstatic.net/LdoS8.jpg I attempted to float it to the right, but its position didn&apo ...

The issue with Angular-gettext is that it fails to update dynamically generated strings in the code

Whenever I try to set the language using the code gettextCatalog.setCurrentLanguage(langString);, it doesn't seem to affect my side-nav menu. My side menu has two possible states: expanded or collapsed, and I use ng-include to control its content base ...

unable to display images from a folder using v-for in Vue.js

Just getting started with Vuejs and I have two pictures stored on my website. The v-for loop is correctly populating the information inside databaseListItem. The path is /opt/lampp/htdocs/products_db/stored_images/cms.png https://i.stack.imgur.com/969U7.p ...

Hover effects using CSS3 transitions for the content before

Greetings everyone, I apologize for any language barriers. The title may not be clear at first glance, so let me explain what I am attempting to achieve. I have a navigation menu structured like this: <nav> <ul> <li>& ...

Can the text be aligned both to the left and right on the same line beneath the

I am looking to arrange 2 links on the left and 1 on the right side below some images of various sizes. Everything in my main div is currently centered. main .about p { margin-left: 50%; transform: translateX(-50%); width: 700px; line-height: 1. ...

Learn the process of utilizing Javascript to substitute additional texts with (...) in your content

I am facing a challenge with a text field that allows users to input text. I want to use JavaScript to retrieve the text from the textbox and display it in a paragraph. However, my issue is that I have set a character limit of 50. If a user exceeds this li ...

When the parent element is set to a fixed size, the child element does not respond to the overflow auto property

I am trying to create a parent div with fixed size that contains two children, but I want only the second child to have overflow set to auto. However, it's not working as expected... Here is the code snippet I used: .parent { height: 200px; width ...

Bootstrap Framework 3 causing horizontal scroll due to header styling

Here is the link you requested: This is the HTML Code: <header id="header-10"> </div><!-- /.header-10-top --> <!-- MAIN NAVIGATION --> <div class="header-10-main"> <div class="container"> ...

Which HTML tag should I choose to apply color to text in Twitter Bootstrap?

I'm looking to enhance the appearance of a specific word in my text. For example: This is my text, <span class="red">this</span> should be red. Would using the span tag be the appropriate method for achieving this effect? Or are there ot ...

How to locate a specific object by its ID within a JSON structure embedded in an HTML template

I am currently working on the page where I display posts. Within my controller, I have: export class PostsComponent implements OnInit { posts$: Object; users$: Object; constructor(private data: DataService) { } ngOnInit() { this.data.getPo ...

Issues with embedding iframes and hyperlinks

Simply put, we have a webpage containing an iframe, and I need to dynamically target the page URL. To keep it clear, our main page is located at . The iframe resides on the 3.aspx page and directs to a completely different URL, let's say . I am aimi ...

When the playback of an HTML5 Audio element is halted, the complete file undergoes downloading

Currently, I am facing a situation where a web page contains numerous Audio elements, some of which have very long durations, up to approximately two hours. To handle these audio tracks, they are created and controlled using the following code: var audio ...

Issue with borders not displaying on cards in Bootstrap 3.4.0

In the 3.4.0 version of Bootstrap, I am facing an issue where cards are not showing borders. I am attempting to include multiple cards within a panel. I have tried using the "!important" property for the border, as well as using classes like "border-prima ...