What are the implications of combining old and new flexbox syntax to ensure broader compatibility?

.flexcontainer {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

It appears that this code is functioning properly, but is it a wise approach? My goal is to enable flexbox on older Android (2.x) devices as well as newer iOS and Android browsers.

Answer №1

I stumbled upon a helpful CSS-tricks article addressing this specific issue. The recommended approach outlined in the article is as follows:

  display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
  display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
  display: -ms-flexbox;      /* TWEENER - IE 10 */
  display: -webkit-flex;     /* NEW - Chrome */
  display: flex;             /* NEW, Spec - Opera 12.1, Firefox 20+ */

  -webkit-box-flex: 1;      /* OLD - iOS 6-, Safari 3.1-6 */
  -moz-box-flex: 1;         /* OLD - Firefox 19- */
  width: 20%;               /* For old syntax, otherwise collapses. */
  -webkit-flex: 1;          /* Chrome */
  -ms-flex: 1;              /* IE 10 */
  flex: 1;                  /* NEW, Spec - Opera 12.1, Firefox 20+ */

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

Displaying a fully customizable loading background color that adapts to various screen sizes while an

I have an application where I fetch an image and its size from a JSON. My issue is that when the image is loading, there is a gap left behind that I would like to fill. The problem arises when I try to use a div with fixed width and height to fill this ga ...

Chrome displaying an extJs Button image

Could it be that Chrome is evolving into the new IE in terms of CSS issues? Here is the code I have for creating ExtJS buttons within an accordion: var button = Ext.create('Ext.Button', { text: '<img src="'+resp.sellers.externa ...

Adjust the appearance of primeng's PanelMenu component

I've been attempting to customize the appearance of the PanelMenu component So far, I've successfully changed the overall background color. https://i.sstatic.net/MGIia.png My goal is to set the main menu items to white and the submenus to blac ...

Each time I load the page, it displays differently depending on the browser. I'm struggling to understand the reason

Trying to figure out how to make the navigation bar close when a link is clicked and directed to a section instead of a new page. When on a large screen, I want the nav bar to remain open but automatically close when on a small screen (for example, when th ...

Struggling to prevent a div element from moving down when resizing the window

I've been struggling to solve this issue on my own for quite some time now. It seems like a straightforward problem, but I just can't seem to figure it out. The problem lies with two divs - one floating left and the other floating right. The rig ...

The challenge of resizing dialog elements in Angular Material

I am currently working on developing a text dialog for my app that will be reused frequently. The text dialog consists of a header, a message displayed above the text input, the text input area, and "Ok" and "Cancel" buttons. Upon my observation, I have f ...

Ensure that two div elements are always aligned, regardless of the circumstances

Is it possible to ensure that my two divs are always aligned, regardless of the content inside them? Sometimes the left div may contain images of varying sizes, while the right div may have text with different lengths. I initially tried setting a min-heigh ...

Persistently Undefined Angular Attribute

I have been trying to dynamically bind a CSS class using an AngularJS function. While the functionality is working properly, I keep encountering numerous errors in the browser console. Can anyone offer assistance with this issue? I have included my code an ...

What is the method for creating a CSS class that will format the printed page into landscape orientation?

After creating a CSS style sheet that can print an HTML page in landscape mode using the @media rule shown below: @media print{ @page {size: landscape;} } I realized that I don't want every HTML page that loads this style sheet to automati ...

Challenges with the dropdown menu navigation bar

I am struggling with my dropdown menu and sign up/sign in buttons as they are not aligning properly. I have tried various coding methods but haven't been able to fix the issue. Can someone provide me with suggestions on how to rectify this problem? c ...

Learn how to design a customized loading screen using CSS with Phonegap

Currently working in Android with Phonegap / Cordova, I am faced with the challenge of optimizing page loading time due to numerous DOM objects being created. To address this issue, I am attempting to implement a "Loading..." screen to prevent users from b ...

Setting a card to the center within a col-md in Bootstrap 4: Step-by-step guide

I'm looking to position this card in the middle, not centered. How can I achieve that? I've already attempted using my-auto, but it didn't work at all. Please take a look at my code and suggest any necessary changes. Thank you! https://i.s ...

My CSS letters are running off the screen. What's the best way to show the complete

Seeking assistance with a header text formatting issue on my website. I am using Google Fonts (Pinyon Script) and have noticed that one of the letters is being cut off. Despite trying adjustments with overflow properties, the problem persists. The specific ...

Enable a single flex item to wrap across multiple lines

I have an HTML code snippet that needs to be styled using Flexbox. Specifically, I want to re-order the elements and create a 'line break' before the last item. How can I utilize Flexbox so that most flex items are treated as atomic units, but on ...

Issues with IE8 compatibility on the website

I'm in the process of developing a website and I'm facing some issues specifically with IE8 or later versions. For reference, here is a temporary link to the site: . 1 The problems I am encountering are as follows: The login/register form disp ...

Quick Tips for Display Flex and Flex Direction in CSS

Is there a simpler way in CSS to merge display:flex; flex-direction: row / column? into one line instead of two? I've heard about flex-flow, which combines both flex-direction and flex-wrap. ...

Switching background colors (green/red) in an HTML void when a specific key is pressed - What's the trick?

Is there a solution available for changing the background color in HTML when a specific button is pressed, like the letter A? I want the color to switch from red to green or green to red when button A is pressed, and I would like it to stay that way even i ...

Does the hoverable region extend beyond the text of the <span> element inside an <a> tag?

It appears that there is a rectangular border surrounding the text, making it also hoverable. I only want the characters themselves to be hoverable. I attempted using a 'span' element to correct this issue but it did not work as expected. a:ho ...

Adjusting CSS using JQuery based on scroll position

I am attempting to dynamically change a CSS style depending on the viewer's position on the page. Despite researching numerous similar threads online, I have not been able to get this code to work as intended. Any assistance would be greatly appreciat ...

Verify whether a checkbox is selected and then add a specific style to the parent element using jQuery

Here is a list with checkboxes: <ul class="cate_select_ul"> <li> <!-- outer checkbox A --> <label><input value="251" type="checkbox" name="post_category[]">Automobiles &amp; Transport</label> ...