Showcase three elements next to each other on the same row (Photo Gallery, Description, and Contact Form)

I am attempting to showcase three divs in a single line while working on a Subtheme for the Drupal 8 Bootstrap Theme. These particular divs are fields nested within a view known as viewproducts.

The divs include:

  1. Juicebox Photo Gallery;
  2. Text: "Title" + "Reference Label:" & "Reference number" + "Description" + "Price Label" & "Price";
  3. Webform: "First and Last Name" + "Email" + "Phone" + "Message" + "Send Button"

The objective is to create product rows, with each row consisting of the described elements positioned in the following order on the screen:

LEFT: Juicebox Gallery          CENTER: Text group of elements          RIGHT: Webform
    

- Gallery: OK;

- Text group: How can I align all elements to center while maintaining the specified order?

- Webform: How do I center all elements while preserving the webform order without accessing HTML directly? I have attempted different styling approaches such as relative position, absolute, and others, but they haven't produced the desired layout.

Below are the class names for the specific elements:

  • Juicebox gallery: "viewimagefield"

  • Text Group:

    • Article Title: "viewtitlelabel" and "viewtitlefield"
    • Article Reference: "viewreflabel" and "viewrefrield"
    • Article Description: "viewdescriptionfield"
    • Article Price: "viewpricelabel" and "viewpricefield"

  • Webform class="viewform": - First and Last Name: "prodformname"

    • Email: "prodformemail"
    • Phone: "prodformphone"
    • Message: "prodformmessage"
    • Send: "prodformbutton"
.viewproducts ul {
      list-style-type:none;
      align-content: flex-start;
    }
    .viewproducts .view-content .views-row{
      float: left;
      height:50% !important;
      margin: ;
    }
    ...
    (CSS styles continue)
    ...
    

The current output shows the Gallery on the left, the Text centered but misaligned, and some elements placed behind the Gallery. The form appears below both sections with various alignment issues. It seems challenging to achieve a specific order in this layout. Refer to the screenshot for an idea of what's happening: enter image description here

Here is the fiddle link. Please note that the HTML structure should not be altered, as I am constrained to work within the Drupal framework without direct HTML manipulation.

Answer №1

To create a layout with equal width sections in the same row, consider using the Bootstrap grid system:

    <div class="row">
        <div class="col-4"> 
        //Left section 
        </div> 

        <div class="col-4">
        //Center section 
        </div> 

        <div class="col-4">
        //Right section 
        </div> 
    </div>

If you prefer not to use Bootstrap, you can also achieve a similar layout by applying float:left; to each div element through CSS.

For more information on the Bootstrap Grid System, check out their official documentation here.

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

What is the best way to place my website's logo in the top-left corner using html and css?

Hello everyone. I am currently working on customizing a website using an HTML and CSS template for a project, but I need to make some modifications. My main goal is to add the company logo to the header, specifically in the top-left corner, however, I&apo ...

Utilize Bootstrap button dropdown to automatically assign a selected value to a list item

I have a form with a select box that transforms into a bootstrap button after the page loads. However, I am unable to set the selected value for the converted bootstrap button drop-down li. <button type="button" class="btn dropdown-toggle btn-default" ...

I am currently working on making my social items more responsive, however, I am encountering some issues. Any ideas or suggestions on how to resolve this

Find my resume project on GitHub at https://faizan-ul-hasnain.github.io/Resume-Project-/ and let me know how to improve it. Visit my resume project here ...

Steps to update the bootstrap version in an existing project

My current project was built using Bootstrap 3.3.6 classes, but now I want to take advantage of the features offered by Bootstrap 5.2. However, simply changing the version of Bootstrap isn't as easy as it sounds. What is the most effective way to upgr ...

Stylish Bootstrap sidebar featuring a vibrant background hue

I am facing an issue with my bootstrap layout where I have two columns - one on the LEFT and one on the RIGHT. The left column should be 8 units wide using the Bootstrap's 12 column grid format, while the right column should be 4 units wide as shown b ...

Creating a button with multiple background gradients using CSS

When working on a button element that already boasts a gradient effect, my aim was to integrate a small play image directly in the center. However, achieving this without compromising the current layout and ensuring compatibility across various browsers pr ...

minimize javascript syntax (stackoverflow 2022)

I'm struggling with this puzzle game. Sometimes, when I start a new game, the pieces get shuffled incorrectly. I tried adding a function to fix it, but it doesn't seem to be working. It's really frustrating and I want to simplify the code as ...

Discrepancies in Span Element Behavior Between Firefox and Chrome

Seeking assistance with a tooltip feature that reveals extra information when a user hovers over a span. The issue arises when the span is split across two lines, causing the extra information to appear in different positions on Firefox and Chrome browsers ...

What is the best way to compare two CSS files and selectively replicate just the discrepancies?

Is there a way to compare and copy different information from CSS files into another file? For instance, if I have two CSS files named a.css and b.css, is there a method to automatically select and copy only the differences between the two files? Thank y ...

The image selection triggers the appearance of an icon

In my current project, I am working on implementing an icon that appears when selecting an image. The icon is currently positioned next to the beige image, but I am facing difficulties in making it disappear when no image is selected. Below are some image ...

Arrange two absolute divs side by side without overlapping each other

I have a specific layout configuration: <div id="container"> <div class="left"> 1 </div> <div class="left"> 1 </div> <div class="right"> 2 </div> </div> My goal is to stack the left divs on top ...

How can we effectively utilize LESS variables in styles.less when working with LESS files within components in Angular versions 6 or 7?

Running Angular version 7.0.0 will generate a folder structure typical for "ng new". Below is the content of my styles.less file: @personal-black: #0000; This snippet shows the content of my app.component.less file: ...

Ways to showcase a collection of divs in a dual-column layout while minimizing any unnecessary vertical spacing

Is there a way to create two columns without changing the HTML structure? The content within each child element is dynamic, so there needs to be dynamic vertical spacing as well. I'm experimenting with different CSS properties for both the parent and ...

Sliding right is done by activating the Switch Function, while sliding to the left can be achieved by deactivating it with the help

My objective is to create a functionality where flipping the switch button will cause it to slide automatically to the right, revealing a red background div. When switched off, it should return to its original position with a yellow background using Jquery ...

How much does it typically cost to implement external libraries into a project?

Here are some of the most commonly used front-end web development libraries: jquery-min.js (95.9 kB) angular.min.js (108.0 kB) bootstrap.min.css (113.5 kB) bootstrap-theme.min.css (19.8 kB) bootstrap-fonts (185.7 kB) bootstrap.min.js (35.6 kB) All in al ...

The alignment of Flex Divs is off despite having identical heights

I'm facing an issue where divs are not staying at the top of their parent div if the image they contain does not have the same height as the others. Within my navbar, I have icons of varying sizes placed inside divs using display: flex to vertically ...

Bootstrap form toggle switch component for ReactJS

I'm having trouble figuring out why the default value for my react-bootstrap switch won't set to false (off). It seems like the only way it changes is when I trigger the onChange event handler. Am I overlooking something? Below is the section of ...

The functionality of the bootstrap grid system may vary depending on the size of the device being

I'm currently experiencing an unusual issue with Bootstrap. From what I understand, the bootstrap grid system is based on 12 units and is supposed to work seamlessly across various device sizes, such as iPhones. I have a simple banner comprised of 5 c ...

Pictures in the portfolio failing to load on Mozilla Firefox

Having some trouble with my WordPress website bmfconstruction.com.au/new/. In the project section, all images are loading correctly in Chrome, Opera, and IE. However, when it comes to Firefox, none of the images seem to be showing up. I've tested this ...

Dynamically changing the borders of WebGL canvases: a guide to adding and

Here is my code snippet for creating an HTML canvas: <canvas id="glCanvas" class="canvases" width="20" height="20></canvas> To set the color, I am using the following: gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); I am w ...