As I work on developing my web application and utilize a bootstrap template, I encountered a situation where I needed to include an inline image with text, with the image floating to the left and the text positioned to the right.
The paragraph element in the html was contained within a div. To achieve the desired layout, I researched and came across suggestions to add an img property to the CSS rule of the parent div. Below is the structure in which I attempted to insert the image:
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<p style='float:right;' > <img src={{ url_for('static',filename='img/ankulGupta.tiff') }}>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur? Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus! Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
</div>
</div>
While attempting to add the float rule to the image, I encountered some difficulties. Despite defining the relevant CSS rules within the parent div, the image layout didn't respond as expected. Eventually, I resorted to directly adding style rules to the img tag to achieve the desired effect:
<img style='float:left; margin-right:10px; margin-top:8.5px; width: 210px; height:194px' src={{ url_for('static',filename='img/img.jpg') }}>
It seems the CSS rules didn't apply properly, prompting me to seek clarification on what might have caused the issue. If you have insights or suggestions on how to better structure the CSS rules for the image, as a beginner in web development, I would greatly appreciate any guidance.