Children divs unexpectedly showing up outside of their parent divs

I have reviewed similar questions on this matter, but none of them seem to provide a solution for the issue I am facing. Currently, my goal is to display a stylized list, but I am encountering more difficulties than expected.

You can find a fiddle linked here. Essentially, I want the text snippet to be displayed next to the image.

Below is the template HTML being utilized (Mako):

% for datum in data.entries:
    <a href="#">
        <div class="result-container">
            <div class="result-header">
                <h1 class="result-title">${datum.data['display_name']}</h1>
            </div>
            <div class="result-body">
                <div class="thumbnail-wrapper">
                    <div class="result-thumbnail">
                        <img class="thumbnail" src="${datum.thumbnail}" alt="${datum.data['display_name']}"></img>
                    </div>
                </div>
                <div class="result-snippets">
                    <div class="snippet">
                    ${datum.snippets}
                        </div>
                </div>
            </div>
        </div>
    </a>
% endfor

EDIT:

I realize that my explanation may not have been clear enough, so please refer to the updated fiddle and comments. Each of these elements is within a LIST, meaning they will appear multiple times down the page. I am seeking a solution that works consistently for every list item.

How can I position the snippet to the right of the image? Alternatively, why does it currently appear as it does?

Answer №1

Modify it to

.image-box {
        /*    width: 285px;
    */
        float:left;
        overflow:hidden;
    }

Revision: Using your latest fiddle Transform it to

.gallery-wrapper {
    margin: 0 auto;
        clear:both;
}

Answer №2

It seems like I have grasped your requirements

http://jsfiddle.net/ZffFv/9/

 .output-snippets {
position: relative;
top: 50px;
left:200px;
}

Answer №3

Are you interested in achieving this layout with the snippet positioned next to the image?

http://jsfiddle.net/ZffFv/2/

HTML:

<a href="#">
     <div class="result-container">
          <div class="result-header">
               <h1 class="result-title">Test Title</h1>
          </div>
          <div class="result-body">
               <div class="thumbnail-wrapper">
                    <div class="result-thumbnail">
                     <img class="thumbnail" src="http://www.anirudh.net/courses/cse585/project1/results/orig/lenna.gif" alt="${datum.data['display_name']}"></img>
                </div>
                    <div class="result-snippets">
                     <div class="snippet">
                     This is a test snippet
                      </div>
                </div>
              </div>
           </div>
     </div>
</a>

CSS:

.result-header {
    text-align: center;
    word-wrap: normal;
    padding-top: 20px;
}
.result-container {
    margin: 0 auto;
}
.snippet {
    color: #666666;
    font-family:"Open Sans", "Arial";
    font-weight: 300;
    width: 200px;
    text-align: center;
    overflow-y: hidden;
}
.thumbnail-wrapper {
    /*    width: 285px;
*/
    overflow:hidden;
}
.result-thumbnail {
    width: 300px;
    overflow-x: hidden;
    float: left;
}
.result-snippets {
    float: right;
}
.result-title {
    text-align: center;
    font-size: 20px;
}
.page-number {
    width: 30px;
}
.search-icon {
    text-align: right;
}

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

Converting user's birthdate input from HTML to their age using PHP

I am facing an issue with retrieving the correct date from a date-time-picker named "dob" and passing it to PHP. When I try to post the date into the database user_age column, it only displays '2017'. However, if I manually set $dob to '10/0 ...

How to horizontally align a logo image in the appBar using Material-UI (ReactJS)

I recently incorporated a Material UI library into my React project (material-ui.com) and I've been trying to center my logo within the appbar component. Here is the code that I attempted: <AppBar position="sticky" > <Toolbar> ...

What is the process for configuring environmental variables within my client-side code?

Is there a reliable method to set a different key based on whether we are in development or production environments when working with client-side programs that lack an inherent runtime environment? Appreciate any suggestions! ...

keeping variables hidden from the user until a certain action is taken

In my project, I am working with three main code classes: 1) node.js (utilizing express framework) 2) index.html (serving as the home page when users visit the site) 3) sck.js which performs a specific function (details to follow on the first and second fi ...

Tips for Omitting Children <li> from CSS Design

I'm currently working in SharePoint Designer and facing an issue with custom bullets in my list. My goal is to apply a custom bullet on the parent li elements (Desc 1 and Desc 2), but unfortunately, it's also being applied to all the children li ...

Elements vanish when SHAKE effect is in use

I've been experimenting with this framework and I'm struggling to get the shaking effect to work properly. Whenever I hover over an element, other divs seem to disappear. I tried using different versions of JQuery and JQuery UI on JSFiddle, and i ...

Moving elements upwards and downwards using CSS transitions

I am currently designing a metro tiles menu for my website, without using JavaScript and only relying on HTML and CSS. The issue I am facing involves the sliding tiles and the direction in which they slide. Additionally, there seems to be a problem where ...

What is the solution to incorporating a scrollbar in a popup when I increase the zoom level?

When trying to add a scrollbar to the popup, I am facing an issue where the scrollbar does not appear when zoomed in to 75% or 100%. It works fine for fit screen but not on zoom. Can anyone help me identify what is wrong with my code and suggest how to han ...

Learn how to activate a JS native event listener using jQuery for the 'change' event

This question is unique from the one found at How to trigger jQuery change event in code. The focus here is on the interaction of jQuery with native event listeners, rather than jQuery event listeners. I am using addEventListener to bind a change event fo ...

What is the correct way to align my checkboxes with their corresponding labels?

I have been working with HTML to make some adjustments to a website. I recently got feedback to change the label of my checkbox, however, it is now overlapping with another checkbox. How can I resolve this issue? ...

Creating a Dynamic Layout with Varying Items in an Array Using PHP

Suppose I provide you with an array of objects, where x represents the number of objects. How would you achieve the following using a grid system (bootstrap, foundation, etc.)? Loop over the array and generate something similar to: I have managed to crea ...

Obtain the title of the text generated by clicking the button using a script function

I am working on a piece of code that generates a text box within a button's onclick function. My goal is to retrieve the name value of each text box using PHP. <script language="javascript"> var i = 1; function changeIt() ...

Add a React component to the information window of Google Maps

I have successfully integrated multiple markers on a Google Map. Now, I am looking to add specific content for each marker. While coding everything in strings works fine, I encountered an issue when trying to load React elements inside those strings. For ...

Using relative positioning in CSS causes the div to move to a new line

Feel free to check out this demo I've created for reference: http://jsfiddle.net/jcb9xm44/ In a nutshell, the scenario involves two inline-block divs nested within a parent div: <div class="outer"> <div class="inner1"> Y & ...

The binding in Knockoutjs is working properly, but for some reason the href attribute in the anchor tag is not redirecting to

Here is the HTML code snippet I am working with: <ul class="nav nav-tabs ilia-cat-nav" data-toggle="dropdown" data-bind="foreach : Items" style="margin-top:-30px"> <li role="presentation" data-bind="attr : {'data-id' : ID , 'da ...

Steps for positioning an element to the left and center of a div

I'm having trouble aligning my two elements in a simple horizontal menu to the middle left. I want them to have a margin of 5px on the left and right sides. Here is a screenshot and CSS style: https://i.stack.imgur.com/vzO5D.png .body_clr { wid ...

Utilize formData to upload an image to a database with ajax

I'm struggling with the process of uploading an image from an HTML form. The goal is for the form to send the image name along with other data to a PHP page. Instead of using the serialized function, I opted for formData as it has the capability to h ...

Transmitting messages from a cross-domain iframe to the parent window

In my parent component, I am embedding an iframe from a different domain. The iframe contains a button that when clicked, I need to capture the event and pass it back to the parent component. I have experimented with using window.postMessage and window.ad ...

Direct your attention to the div element using ng-click

I'm encountering a complex issue while developing an AngularJS input helper component for number fields in my web application. To better explain the problem, let me give you some background on how our components function: Each component consists of i ...

Alternative background for browsers that do not have support for border-image styling

I am experimenting with CSS3 border-image to create a simple button design: the left slice of the image is intended to be the left border of the text, the right slice as the right border, and the middle slice should either repeat or stretch as a background ...