What could be causing certain CSS rules to not take effect?

In my current project, I have a Flexbox layout nested within Bootstrap v4 that switches orientation based on landscape or portrait mode. There is a primary div called #no, managed by Flexbox using the order property, which contains five icons serving as buttons. The issue arises when trying to use the order property to arrange these icons in a specific order.

When no order property is utilized, the icons follow the natural sequence. However, applying the order property does not produce the expected results. As shown in the provided code, the info-div (order: 3) should appear last, but it doesn't. While adjusting the order directly in the source can achieve the desired outcome, I am seeking clarity on this discrepancy.

html,
body {
  width: 100%;
  height: 100%;
}

Answer №1

CSS Comments: Use /* ... */ for Effective Code Organization

The issue you're facing is not with your flex code.

Your problem lies in using // line comment syntax for commenting, which is not considered valid CSS.

button:HOVER { // hover effect
   background: lavender;
}

// styling images below
.image { width: 10vmin; }

By utilizing the incorrect commenting method, instead of simply commenting out the line, you are triggering CSS error handling, resulting in the subsequent rule being disregarded. Essentially, any declaration following your // descriptive text here is overlooked, akin to including: yheight: 60px.

Hence, the reason why the order property fails for your icon:

// defining elements within #no
#info-div1 {
    order: 3;
    -webkit-order: 3;
}

Stick to the conventional approach of CSS comments by commencing a comment with /* and concluding it with */.

/* content to be concealed */

Upon rectifying the code adjustments, the order attribute will operate seamlessly (leading to other modifications due to previously unacknowledged code). For a revised demo, click here.

Further insights on CSS comments can be explored at these resources:


Finally, as an additional point:

You are positioning vendor-prefixed parameters after the standard non-prefixed equivalents.

#container {
    flex-wrap: nowrap;
    -webkit-flex-wrap: nowrap;

    justify-content: center;
    -webkit-justify-content: center;

    align-items: center;
    -webkit-align-items: center;

    align-content: space-between;
    -webkit-align-content: space-between;
}

Consider reversing this sequence. Place the unprefixed (W3C) variant last to ensure its preference in the cascade. Learn more 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

Exploring Media Queries Using Chrome Dev Tools

After an extensive search, it seems that the issue may lie in the fact that what I am seeking does not actually exist. When updating websites, I find myself constantly tracking down media queries. Is there a method to display all media queries for a speci ...

Insert HTML code that is activated when the selection is modified

I have a simple dropdown menu in my HTML code. HTML <select name="breed" onchange="breedChanged()"> <?php while ($row = gdrcd_query($result, 'fetch')){ ?> <option value="<?php echo $row['id_breed']; ?& ...

Fetching Information From Database Using PHP

I am encountering an issue while attempting to transfer data from my HTML table to my modal (without using bootstrap). In the image below, you can see that I have successfully displayed data from MySQL database in the table. The problem arises when I clic ...

Setting the default value for ngModel does not receive any information from the model

I am trying to populate a form with default values using the code below: <h3>ِStart Time</h3> <div class="row" > <div class="col"> <label for="startTime">Hour(s) </label> <input type="numb ...

Executing a post request asynchronously and storing the retrieved data into a variable

Currently, I am in the process of learning AngularJS and attempting to upgrade my current method of fetching data from a web service and dynamically assigning it to a variable that is binded using ng-repeat. My main objective is to implement an asynchronou ...

How can I restrict the number of characters per line in a textarea using javascript or jQuery?

Is there a method to control the number of characters per line in a textarea? For example, on lines 1-3 of the textarea, only 20 characters can be entered, while on subsequent lines, up to 50 characters are allowed. The current structure of the textarea l ...

CSS Issue with Background Image not Fully Covering Viewport Width

Why isn't the CSS background covering the entire viewport width when using media query @media (max-width: 62.5em)? https://i.sstatic.net/yvGWd.png I've attempted to use background-size: cover, background-position: top left, and background-repea ...

My AngularJs code seems to be throwing some errors

I recently started learning Angularjs and here is the code I have written: <!DOCTYPE html> <html> <head> <title>ng-Messages Service</title> <script src='https://ajax.googleapis.com/ajax/libs/jquery ...

Ways to handle errors when using navigator.clipboard.writeText

document.queryCommandSupported('copy') may not be available on all browsers. I experimented with the code below, which successfully copies the link on Firefox but fails on Opera. It displays an alert indicating that the code has been copied, yet ...

Is it possible to find a match by searching through multiple arrays for a corresponding variable name?

Hi there, I'm currently working on a function that triggers an alert if the name of an array of images matches the data attribute of the selected element. This is just a test phase before proceeding with my main project, but I've hit a roadblock. ...

Issue with window.getSelection() function in Mozilla Firefox

I have implemented code to retrieve the window.getSelection() and assign it to a variable in order to store the current focusNode and offset when the contenteditable div onBlur event is triggered. This functionality works as expected in the Chrome browse ...

What are some strategies for accessing the original values of form components that have not been altered when using ngModel?

I am currently developing a form and I intend to utilize the previous values as "value" in the form. By employing ngModel dynamically, I am able to change some properties. However, I have encountered an issue where the field that remains unchanged by the u ...

Disabling the @import cache feature in LessCSS Assetic

I'm facing a minor issue that is robbing me of precious time. Currently, I am using the assetic plugin with the lesscss filter in my symfony2.1 project. The problem lies in Assetic not detecting changes in imported files when using the @import functi ...

Tips for maintaining the webcam video in the center of the screen even when the height is set to 100% and the window is being resized

When using React, I encountered an issue with centering a webcam video while maintaining its height at 100% of the screen. Although the video fills the screen vertically correctly, adjusting the width of the window causes the video to lose its centered pos ...

Setting the parent's height to match one of its children

I'm struggling to align the height of the pink '#images-wrap' with the main image. When there are too many small rollover images on the right, it causes the pink div to extend beyond the main image's height. If I could make them match i ...

Is there a way to create shared borders among Bootstrap columns?

Creating a Bootstrap container with two columns is my current task. The layout should display the columns side by side horizontally on larger screens, and stacked vertically on smaller screens with a 1px border surrounding each column, featuring rounded co ...

The media does not need to be applied to the ".nav__btn" class

How can I hide an element with the ".nav__btn" class by setting its display to none when the screen width is at least 768px? I tried the following media code but it doesn't work. Media Code @media (min-width: 768px) { .nav__btn { display: ...

Methods for concealing the "image not found" icon in Internet Explorer and Chrome through CSS

I have images displayed on a webpage. Currently, when an image is not available, both Chrome and IE display a broken image indicator. I want to hide this indicator and only show the alternative text. Is there a CSS solution to achieve this? ...

Navigation that sticks and changes upon hovering over div elements

Just delving into the world of jQuery and JS, so I appreciate your patience:) Currently, I have a sticky navigation bar positioned at the top of my webpage that links to different sections of content below. I am looking to create an effect where the corr ...

The justification feature in HTML CSS does not seem to be functioning as intended

<table > <tbody> <tr> <th colspan="1">FrisBar:</th> <th > <p style="color:#111;">00</p> </th> </tr> ...