text: vertical placement of divs instead

I am struggling to position my platform divs, each with 3 children-divs, horizontally inside the wrapper div. Despite setting the '-webkit-box-orient' property to horizontal for both the platform div and its children, I cannot get it to work. Any tips on how to resolve this issue would be greatly appreciated! Thanks in advance! - Hobby

<div id="wrapper">


<?php
$platforms = get_platforms();

foreach ($platforms as $platform)
{
echo 
'<div class="platform">
    <div class="platform_left"></div>
        <div class="platform_middle"></div>
        <div class="platform_right"></div>
    </div>';
}
?>

</div>

//CSS styling:

#wrapper{
max-width: 960px;
margin: 180px 0px;
border: 1px solid black;
background:-webkit-radial-gradient(top,#99CCFF,#E6F0FF);
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-flex: 1;
background:-moz-radial-gradient(top,#99CCFF,#E6F0FF);
display: -moz-box;
-moz-box-orient: vertical;
-moz-box-flex: 1;
}

.platform{
border: 1px solid blue;
margin: 30px 30px 0px 30px;
width: 435px;
height: 180px;
background: #99CCFF;
-webkit-border-radius: 5px;
-webkit-box-shadow: rgba(110, 110, 100, .7) 8px 8px 8px;
-moz-border-radius: 5px;
-moz-box-shadow: rgba(110, 110, 100, .7) 8px 8px 8px;
display: -webkit-box;
display: -moz-box;
}   

Answer №1

Elements within the parent div.platform should have the same width as the parent itself.

To achieve this, set their width to 33% (or smaller if using borders, margins, and padding), then apply a float property with a value of left.

No changes are necessary in the PHP code.

According to W3C:

The box-orient property is not currently supported by major browsers.

Apologies for any language errors in my explanation.

Answer №2

Double check your calculations in case there is something else causing the issue. Are you working within a content management system or using any other tools that may have additional CSS settings? Sometimes, it can be useful to not only inspect an element but also hover over it with the element inspector activated (if you're unfamiliar, ensure you have a tool like Firebug for Firefox or right-click on an element to inspect it in Chrome) - this will display the true dimensions of the element. Take a look at the "computed style" as well.

If you notice a width that doesn't match your expectations, navigate up the page and examine each element until you identify the one with the unexpected width.

It's common to encounter this issue when creating website themes within a framework. If the measurements within your wrapper are accurate, something may be compressing the dimensions of the wrapper div. Keep an eye out for gutters such as unusual padding or margins from another stylesheet.

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

A different way to center elements using CSS

Many criticize the center tag, but I find that it consistently aligns things perfectly for me. Despite its deprecation, I still rely on it. I've come across suggestions to use the mysterious CSS margin: 0 auto;, but I struggle to make it work (refer ...

Duplicate CSS designed file upload buttons

I have used CSS to style an input type file. Whenever I click on a plus button, it duplicates the input field. However, this duplication only visually happens with an unstyled upload button. Hint: To replace the standard button with a styled one, I hide i ...

Building a Loading Bar with Two Images Using JavaScript and CSS

I am currently experimenting with creating a progress bar using two images: one in greyscale and the other colored. My goal is to place these two divs next to each other and then adjust their x-position and width dynamically. However, I'm having troub ...

Guide on jQuery: Concealing the scrollbar on the body

Is there a way to hide the scroll bar using Jquery? I tried this code for Chrome but need a solution that works for all browsers. $ ::-webkit-scrollbar { display: none; } Any suggestions on how to achieve this cross-browser compatibility? ...

Creating a div caption that mimics a form label, but with the background div border removed, can be achieved

Is there a way to create a div caption similar to a form label (positioned in the middle of the border), but without the div's border interfering? The issue is that I can't just use a background color for the H1 (caption) element because there is ...

Using jQuery to enhance the functionality of the drop-down select feature

I am facing an issue with my index file code. When I select something from the drop-down menu, I expect to see a related dropdown appear. Although I have added this code to my file, I am unable to get the drop down to show after selecting the main type. ...

Exciting feature: Changing text color dynamically with Sass

Is it possible to create a mixin that sets text color based on the background? It seems straightforward with one color, but how about when there are two colors or changing the color of half of the text? Try changing the text with a blue background.. http ...

Make sure that your inline-block elements are aligned with both the left and right edges of their

Explaining what I'm attempting can be a bit tricky, but I'll do my best. I have X number of categories that I need to organize. Each category needs to be enclosed in a box with a grey border. I want the category boxes to be displayed "inline-bl ...

What are the steps for transitioning with JavaScript?

My goal is to make both the <hr> elements transition, but I'm struggling with only being able to select the lower <hr> using CSS. html { margin-bottom: 0; height: 100%; min-height: 100%; } body { margin-top: 0; height: 100%; ...

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 ...

What is the trick to creating uneven sides (lower left and lower right) with varying heights?

Struggling to articulate my design vision, I'm attempting to achieve a unique look. Although I've explored the transform function, it's not quite what I'm looking for. Instead of rotating the div, I want a diagonal ending. Can this des ...

Text overlapping when viewed on a mobile device

I am facing a problem with the mobile view on bootstrap where my text is overlapping the next section. https://i.sstatic.net/gqpDP.png The smallest media query I am using is for 768px and I am testing this on an iPhone XS Max screen. @media screen and (m ...

Steps to resolve background image problems

Currently encountering issues with the application where the background image is not showing up behind the login form. This problem arises while using a bootstrap template for the website. Attempted to set the background image in the .main-content div with ...

elevate the font size specifically for the descendants of a particular element

Currently, I am using rems to define the font sizes in my project. However, I have encountered a situation where I need to scale the font sizes at specific breakpoints without affecting the entire page, but just the text within a certain container. I under ...

Updating backgroundPosition for dual background images within an HTML element using Javascript

Issue at Hand: I am currently facing a challenge with two background images positioned on the body tag; one floating left and the other right. The image on the left has a padding of 50px on the left side, while the image on the right has a padding of 50px ...

Changing the animation associated with a hover action - tips and tricks!

My navigation header includes links to various websites, some of which are displayed as drop-down menus. I have implemented an animation and style change on hover to visually indicate the active link and display all available options in case of a dropdown ...

Retrieve a random element from a selection of objects within an Array using JavaScript

Hey fellow Developers, I'm having trouble getting a random piece of data from some objects in an Array. When I try to display it, all I see is [object Object] instead of the actual text from the object. I've tried various methods but nothing seem ...

Unique events catered to specific devices: mobile vs. desktop

When a user clicks on the login icon from a desktop, I want a modal dialog to appear. However, when using smaller devices like mobile or tablets, I prefer that a reactjs route is triggered to display in the main content area instead of using a modal dialog ...

Struggling with CSS to display images

Struggling to align my images within the designated red lines in the CSS sections I created. Can't seem to get it right. Here's my HTML: <!-- Your code goes here --> <div class="container"> <section class="left"> <h1& ...

Will the identifier "id" be considered unique if the element with the matching id has its display property set to "none"?

Imagine you have a DIV element in your document with the id "row". Now, if you add another DIV with the same id and change the display property of the first DIV to "none", does the id of the second DIV become unique? ...