Wrapping Text around an Image in HTML

I am currently in the process of designing a website using the flexible box model. My main challenge right now is trying to align text to the right of an image, and then below it. I've attempted using float:right/left along with align="left/right", but these options seem to cause the image to disappear. Could this issue be related to the flexible box model? Below is the source code I have been working on, which includes an article example borrowed from the World of Tanks website.

<div id="content">
    <section id="section">
        <div id="title">
            <h1>This is the Title</h1>
        </div>
        <div id="info-p">
            <div id="photo">
                <img id="img" src="400x300.png">
            </div>
        <article id="info">
            <p>
                [Text from World of Tanks article goes here]
            </p>
        </article>

    </section>
</div>

Some of the article content appears to be separated from the code for some reason. Here is the corresponding CSS:

#section{
font: 14px Trebuchet MS;
}
#title{
text-align:left;
display:-webkit-box;
-webkit-box-pack:left;
padding:5px;
margin:10px;
}
#info-p{
display:-webkit-box;
-webkit-box-pack:left;
padding:5px;
margin:10px;
}
#photo{


}
#info{
display:-webkit-box;
-webkit-box-pack:left;
-webkit-box-flex:1;
padding:5px;
margin:10px;
max-width:800px;
}

Thank you for any assistance provided. Apologies for the messy formatting – this is my first time posting here.

Answer №1

This design is being affected by the webkit box element...placing it within the article tag would be more semantically correct.

You can see a working example here: http://jsfiddle.net/34u4bhkh/

#section{
font: 14px Trebuchet MS;
}
#title{
text-align:left;
display:-webkit-box;
-webkit-box-pack:left;
padding:5px;
margin:10px;
}
#info-p{
padding:5px;
margin:10px;
}
#photo{
float:right;
    margin-left:5px;
    margin-bottom:5px;

}
#info{
padding:5px;
margin:10px;
max-width:800px;

}

Answer №2

It appears that the closing </div> tag for your info-p div is missing. Simply add float: left to it and it should function properly.

Check out the demonstration.

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

Encountered an issue locating the stylesheet file 'css/style.css' that is supposed to be linked from the template. This error occurred when trying to integrate Bootstrap with Angular

<link rel="stylesheet" href="plugins/bootstrap/bootstrap.min.css"> <link rel="stylesheet" href="plugins/owl-carousel/owl.carousel.css"> <link rel="stylesheet" href="plugins/magnific-pop ...

Prevent scrollbar from appearing while splash page loads

Looking for help with a script to create a splash/intro page loader. $(function(){ setTimeout(function() { $('#splash').fadeOut(500); }, 6000); }); The current script hides the intro page after 6 seconds, ...

angular index.html code displayed

I successfully deployed an Angular app on a server in the past without any issues. The Angular version is 6.1.1, Angular CLI version is 6.2.9, npm version is 6.13.4, and node version is 10.18.0 for both local and server environments. The server is running ...

After the automation is finished, I am interested in outputting the IMDB rating of a movie or series to the terminal

I prefer using Google search to find the element because I find it easier to navigate compared to IMDB. import selenium.webdriver as webdriver print("This script is designed to retrieve the IMDb rating of a movie or TV series!!!") def get_results(search_ ...

Why is it that when I refresh the page in Angular, my logged-in user is not being recognized? What could be causing this

I am developing a Single Page Application using the combination of Angular JS and Node JS. In my HTML file, I have defined two divs and based on certain conditions, I want to display one of them using ng-if. However, I noticed that the model value used in ...

The MIME type text/html was ignored along with the AddType directive

Encountering an issue where attempting to load a CSS file from a folder results in the console error: "Resource interpreted as Stylesheet but transferred with MIME type text/html". Attempts to resolve this by adding an .htaccess file (in the root/same fold ...

Insert between the top navigation bar and the sidebar menu

I am currently in the process of designing my very first website and I have encountered a bit of trouble. I would like to add a page between a navbar and a vertical bar, and I want this page to be displayed when a button on the vertical bar is clicked. You ...

Exploring Selenium WebDriver: Manipulating Table Elements and Iterating Through Rows

Is there a more efficient way to iterate through tables row by row without using Absolute Xpath? In my test case, I need to search for specific data in each row. This was the previous logic of my code: private static int iRow; WebElement sWorkUnitRows = ...

Troubleshooting a vertical overflow problem with Flexbox

Struggling to design a portfolio page for FreeCodeCamp using flexbox layout due to vertical overflow issues. Here is the HTML: <div class="flex-container flex-column top"> <header class="flex-container"> <h1 class="logo"><i clas ...

Encountering a problem with ng-repeat when working with a JSON

Having a bit of trouble displaying the keys and values from a JSON object in an HTML table using ng-repeat. The JSON object is coming from the backend, but for some reason, it's not showing up on the frontend. I know there must be a simple mistake som ...

What is the best way to animate the scaling of a CSS property using jQuery?

I need help creating an animation where a circle div with the class of "bubble" grows from nothing to its full size when a button is clicked using jQuery. I am currently facing difficulties in making it work properly. Here's my current code snippet: ...

utilize the flex index.html layout

Upon reviewing the template, I noticed that there is code implemented to check if the client has the necessary version. This code performs certain actions based on whether or not the required version is available. Additionally, there seems to be an <obj ...

In the XHTML mode, MathOverflow's invaluable mathematical expertise shines brightly

I am interested in incorporating the unique “piece of valuable flair™” from MathOverflow onto my website. The issue I am facing is that I want my webpage to comply with XHTML5 standards, meaning it should be served with the MIME type application/xht ...

The ongoing battle between Carousel full page image slider and multi div slider in Bootstrap 4

I need a full-page carousel image slider in one div container and a multi-div slider in another div container on my homepage. Unfortunately, due to some conflicting class names (such as carousel slide, carousel-inner, etc.), they are interfering with each ...

Obtain content from a div element using jQuery

Here is a snippet of HTML code that I am working with: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>Demo</title> </head> <body> <script src="jquery.js"></script> <scri ...

The items in the Bootstrap dropdown are not displaying

I am currently working on a project using Angular 12, and I encountered an issue with my Bootstrap dropdown menu not displaying any items. Below is the HTML code snippet causing the problem: <nav class="navbar navbar-expand navbar-dark"> ...

Enhancing your design with animated borders on hover

This unique border animation caught my eye and sparked my curiosity. I'm interested to know if it can be achieved using only HTML5/CSS for a hover effect. Have you discovered any other visually appealing hover animations worth mentioning? ...

Resolving conflicts between Bootstrap and custom CSS transitions: A guide to identifying and fixing conflicting styles

I am currently working on implementing a custom CSS transition in my project that is based on Bootstrap 3. The setup consists of a simple flex container containing an input field and a select field. The functionality involves using jQuery to apply a .hidde ...

Interactive tables created using Google Visualization

I have a Google visualization data table that works well, but I am facing an issue with the width of the table. When I click as shown in the image, I call the function drawTable(); and then I encounter this: As you can see, the table does not have a width ...

Center a form using Bootstrap

Struggling to center my form using bootstrap as a beginner. I've tried different methods without success. Hoping for some guidance on how to center it while keeping the same size. Any assistance would be appreciated! This is the HTML code: <div ...