What is the reason that flex-direction: row function is only successful when I specify the element to display as inline-block?

When I include display: inline-block in the nav li{}, the flex-direction: row works, as evidenced by the functioning of

-webkit-flex-direction: row-reverse;
. However, other properties like justify-content: space-between; do not work.

Conversely, when I remove display: inline-block from the nav li{}, only flex-direction: column works. What could be causing this issue?

nav{
    background: grey;
    display:-webkit-flex;
    -webkit-flex-direction: row;
}

nav li{
    list-style: none;
}
<nav>
    <ul>
        <li><a href="#about">About</a><li>
        <li><a href="#skills">Skills</a></li>
        <li><a href="#education">Education</a></li>
        <li><a href="#experience">Experience</a></li>   
        <li><a href="#portfolio">Portfolio</a></li>
    </ul>
</nav>

Answer №1

It creates a false sense of effectiveness.

By applying Flex at the <nav> level, you make the <ul> a flex item without influencing the <li> elements.

The desired setup is for the Flex container to be the <ul>.

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

I am looking to transfer the data stored in a variable within a JavaScript function to a different PHP page

Here is my form featuring the summernote editor: <form class="form-group" action="upload.php" style="width: 700px;" method="post" enctype="multipart/form-data"> <label> Title: </label> <input name="title" class="form-c ...

The problem with the Image Gallery carousel not functioning properly in a right-to-left direction arises when attempting to modify

I have been developing an image gallery that functions perfectly in the English version of the website. Now, I am tasked with replicating the same functionality for another version of the website that requires right-to-left (RTL) direction. However, when I ...

What is the best way to render multiple components from a single file in the App.js?

I am currently in the process of learning React.js and I have a question regarding displaying multiple components in App.js. Specifically, I have two pages named Home.js and About.js. When running the code, if you click on "About Us", only the About Page ...

CSS: The addition selection operator is not functioning as expected

The span's background color is not changing correctly when the radio button is changed. Why is this happening and how can it be fixed? div { margin: 0 0 0.75em 0; } .formgroup input[type="radio"] { display: none; } input[type="radio"], label { ...

Add information to the <script> tag

There is a row that I sometimes clone. <script id="SubRow10" type="text/template"> <select id="SubSelect10" class="form-control" name="SubcategorySelect" required> <option value="m,2">Op1</option> <option value="m,3"&g ...

Efficiently Aligning Elements in CSS both Vertically and Horizontally

I'm struggling to align my form both vertically and horizontally. It's okay if this doesn't work on IE - I will include an IE detection script to prompt users to switch browsers. However, Firefox and Chrome support is essential. Below is m ...

Styling an element with CSS through JavaScript manipulation

Welcome to my first post here! :) So, I'm currently working on a project for my college where I need to create "task notes" that fade in each time I add one to an array. .note_input { height:255px; width:200px; background-image:url(&apos ...

"Utilizing React.js to implement white-space styling on numeric values for

I am a beginner in Reactjs and eager to learn and improve. Here is some code I have been working on: there's an <h1> element with the text "test", and beneath it, I want to display numbers vertically like this: 1:1, 1:2, 1:3. However, the CSS do ...

Are the elements in Chrome overlapping due to the box model?

I'm currently experiencing a problem of cross-browser compatibility between Chrome and Firefox. Upon inspecting the webpage in Chrome, it's evident that the box for the #content DIV is overlapping with the box for the H3. When viewed in Firefox ...

Activate/deactivate CSS transition using jQuery hover state

Trying to prevent a "reversing" css transition when un-hovering the element. To keep it in its "forward" position and repeat the "forward" transition upon hovering again is the goal. This is what has been attempted: Using jQuery jQuery(document).ready(fu ...

When switching between tabs on Twitter Bootstrap, the page automatically scrolls to the top

I am encountering an issue with my tabs setup. Each tab has a different height and there is a Row on top of the tabs. You can see the problem in action on this JSFiddle. Whenever I switch from a tab with greater height to a tab with less height, the page ...

What causes the iframe to protrude beyond the bottom of the page when set to 100% height?

I am facing an issue with an iframe on my website that is contained within a div. I have specified both to have a height of 100%, and I am using the blueprint framework, hence applying the class span-12 last. Despite these settings, a scroll bar still appe ...

I am facing an issue with the Options functionality in Materialize, and the remove method does not seem to work when I am using the

Having a little trouble appending options in a materialize select for my project. Can someone take a look at my code snippet below and provide some guidance on what changes I should make? Thanks! $(document).ready(function() { $(".condition").click(fu ...

Avoid duplication of elements in Angular applications

Currently, I have a component that loads animated divs based on a datasource. *Note: In the example, I've used a lot of <any> because I haven't finalized the model yet. apiService.ts dataArray: Observable<Array<any>>; constru ...

Stylish date picker in CSS

Here is a design mockup along with my current solution. The issue arises when two numbers are adjacent to each other (either horizontally or vertically) as they should merge, illustrated in the mockup below. For example, when selecting numbers 48-49-50, t ...

Creating a button that adjusts its size proportionally to the page and surrounding elements, all without relying on positioning

I'm fairly new to creating websites with CSS and HTML, and I'm currently working on a project about my time in China. The main issue I'm facing right now is aligning a button with my other contact icons and ensuring it scrolls correctly with ...

Odd spacing at the bottom of the page

I'm experiencing an issue with the footer on my homepage - it has a strange margin around it that I can't seem to get rid of. What I really want is a simple footer with 100% width, similar to the one on this page. However, as you can see in the i ...

The background image is overly magnified

I've been having an issue with the background image on my div looking too zoomed in and losing its clarity. Below is the HTML and styling that I have attempted: <div class="grid-x intro"> <div class="cell large-12 medium-12 small-12 ...

Avoid creating a line break directly after the header, however allow for a line break

I find myself in a scenario where I require a paragraph that has a specific format: An Emphasized Title Some relevant information regarding the subject... I am looking to insert a new line before the title, ensuring it seamlessly integrates with the re ...

Transform a <td> into a table-row (<tr>) nested within a parent <tr> inside an umbrella structure

Similar questions have been asked in the past, but I still haven't found a solution to my specific inquiry. Here it is: I have a table that needs to be sortable using a JavaScript plugin like ListJS. The key requirement is that I must have only one & ...