Troubleshooting problems with the masonry layout in HTML (asp.net)

I'm working on my website and trying to implement masonry to achieve a nice layout for my content. However, I've been encountering some strange results so far. Below is the code I'm using:

<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 well well-sm news-box" style="background-color:@color" 
     data-masonry='{ "columnWidth": ".masonry-container", "itemSelector": ".masonry-container" }'>
    <div class="masonry-container">
        <div class="contain">
            <img src="@w.Image" class="image img-responsive" />
            <div class="middle">
                @getReferrals(w.Id)
            </div>
        </div>
        <h4>@w.Title</h4>
        <p>@w.Body</p>
    </div>
</div>

It seems like the outer has the masonry functionality. I have not used jQuery because I couldn't get it to work properly, and HTML is giving me incorrect results. The current output looks like this: https://i.sstatic.net/2Pyh6.jpg

In addition, this content is within bootstrap tabs. When I tested it outside of the tabs, it worked fine but inside, it's causing issues.

If anyone could offer assistance, I would greatly appreciate it! Thank you in advance.

Answer №1

When implementing masonry layout, it's important to remember to apply the rules at the row level and align them with the columns to avoid any unusual layouts.

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

Is it important that the end date does not exceed the start date?

In my request, the end date cannot be later than the start date. For example, if the start date is 24/4/2017 and the end date is 23/4/2017, the search function should be disabled for the calendar date 23/4/2017. Only dates from 24/4/2017 onwards should be ...

Safari enables seamless text flow into the footer without triggering scrolling as long as the length is manageable

Encountering a unique issue solely in Safari 6.0.5 on OS X 10.8.4 within certain conditions, which doesn't exist when tested on Firefox or Chrome under various scenarios in OS X. The column layout with floats is the crux of the problem. When the text ...

Issue with Attaching Click Event to Dynamic Div Elements

I've implemented divs with a Click Event triggered by a value entered in a text box. See an Example Here Upon opening the page, clicking any rows will trigger an alert. However, if you change the value in the text box (Enter Number) and click load, ...

Struggling with integrating JSON data into JqGrid

I've encountered a challenge with binding my Json data to a JqGrid. Within my Default.aspx.cs file, I have the following method: [WebMethod] public static string GetData() { CustomerHelper C = new CustomerHelper(); ...

What is the process for displaying a Bootstrap Icon on a webpage?

I recently started using Bootstrap and I'm in the process of creating a login screen for my app. I want to incorporate MDBIcons for Google, Twitter, and Facebook. I referred to the documentation provided at However, upon previewing my webpage, I enco ...

Sentence following the original passage

I want to achieve a similar look as the example below: Here is what I have done so far: h2:after { content: ""; display: inline-block; height: 0.5em; vertical-align: bottom; width: 48px; margin-right: -100%; margin-left: 10px; border-bo ...

Restricting thumbnail scrolling within the visible area in a jQuery/CSS Gallery/Slideshow

Is it possible to create a gallery slideshow feature where the selected thumbnail's image source will be displayed in the main image container? I believe I can implement that part successfully. Currently, my challenge is defining the thumbnail scroll ...

When the onclick event is triggered, the return value will execute after the onclient

After my onclientclick event finishes, I am trying to run my onclick event. However, regardless of whether my checkbox is selected or not, the program keeps prompting me to "Please select at least one to delete." Can anyone help me figure out why this is h ...

Tips for aligning an element vertically when it has a float using CSS or JavaScript

I am struggling with centering the image within the article list loop I created. The code snippet looks like this: <article class="article <?php if($i%2==0) { echo 'even'; } else { echo 'odd'; } ?>"> <section class ...

A guide on implementing radio buttons in Angular 2 and sending the selected value via a HTTP post request

As a newcomer to Angular 2, I am struggling with the following code: Here is my HTML <form action="POST" (submit)="register()" class="aa-login-form"> <input type="radio" [(ngModel)]="gender" name="sex" value="MALE"> Male <input ...

Insert additional div specifically after the fifth post using PHP within a Wordpress website

I've spent countless hours scouring the internet in search of a solution. The results are filled with people facing similar issues - they want a (div) to appear after a certain number of posts and repeat continually. My specific problem lies in needi ...

various ways to select parent and child elements in CSS

Can someone explain the distinction between: li ul {color:red;} and li > ul {color:yellow;} I've tested both and they seem to produce identical results. ...

Arrange the div and ensure that the external JavaScript file functions properly when the page loads

I am encountering an issue with my JavaScript and CSS code. It works perfectly fine within the fiddle environment but fails to function properly outside of it. Here is the link to the fiddle When I embed the code into an HTML document directly, it does n ...

Getting the nth-child rule for CSS in IE9 to function properly in IE8

This code is functioning in IE9: body.country-XYZ .abc:nth-child(3) { display:none; } As :nth-child() is effective in IE9 and newer versions, what can be done to ensure it also functions on IE8? Can you suggest an alternative method for achieving th ...

Unable to choose an option from the panel

I am currently working on a menu and panel setup (you can view the demo here: http://jsfiddle.net/vals/j2LrQ/1/). The visibility of the panel depends on the selected item from the menu. However, I am facing an issue where the panel disappears when I move ...

Design a layer that rests on top of a specific table column

I am currently working with a table that consists of 5 columns (city, 1st quarter, 2nd quarter, 3rd quarter, 4th quarter). My goal is to create an overlay on each column if we have already passed a specific quarter. However, I am encountering difficulties ...

Creating a custom form to generate a unique URL on a website

For instance, users on a platform like Craigslist can fill out a form specifying their requirements. Upon submission, the platform automatically generates a new URL hosted on its website. I am unsure of how this process works or what it is called. Can an ...

JavaScript, CSS, and HTML - elements that dynamically adjust their size according to the content they hold

Being brand new to web development, I have a task of creating objects that feature text in a box with rounded edges, similar to the image provided. The challenge is that the border size needs to dynamically adjust based on the text size. Restrictions on u ...

Take out the username field from the registration form in Woocommerce

Is there a way to eliminate the username section from the registration form on woocommerce? I attempted to remove certain lines from the woocommerce/myaccount/login-form.php <?php if ('no' === get_option( 'woocommerce_registration_gene ...

Component built in ReactJS for file uploads to a server running on Spring MVC/Data-REST

For quite some time, I have been on the lookout for a ReactJS component that enables file uploading from a browser, with the ability to save it to the server where the ReactJS application is deployed. I've come across several components that facilita ...