Does the display:flex property get passed down through inheritance?

I have been working on this code where I assigned a display:flex to my body element. My understanding was that all child elements within the body would automatically become flex items, considering the body is both a flex container and a wrapper for its children. However, upon inspecting the developer tools in Firefox, I noticed that setting properties like align-items and justify-content had no effect, as the body was neither a flex container nor a grid container.

I'm now seeking clarification on when it's necessary to individually give divs, sections, or mains their own display:flex property, as opposed to relying on automatic inheritance.

Below is an excerpt from my code:

#html 
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Butterfly Music App</title>
</head>

<body>
    <main>

    </main>
    <footer>

    </footer>
</body>

</html>
#css
html, body {
    height: 100%;
}
body {
    display: flex;
    flex-direction: column;
    background-color: cyan;
    font-family: gabriola;
    color: purple;
}
footer {
    justify-content: flex-end;
    align-items: flex-start;
    flex: 0 0 120px;
    background-color: pink;
}

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

Is it possible to use AngularDart's ng-repeat directive in HTML tables

I've been struggling to iterate over lists with sublists and display them as <tr> elements without much luck. The following code represents what I'm trying to achieve: <table> <tr> <th>1</th> <th>2& ...

Sort through a list of items by the key input when characters are removed from the input field, ensuring that the color remains constant

<ul class="locationlist list-unstyled"> <li> <div class="checkbox checkbox-success"> <input id="checkbox1" type="checkbox"> <label for="checkbox1"> Vijayanagar </label> </div> </li> <li> <div class=" ...

CSS issue: Font size

Can someone help me out with a CSS issue that has been tripping me up? I've been working with CSS for three years now, and this particular problem is stumping me. I have defined some styles in my CSS file that should be applied to the content of my w ...

Attempting to transfer a user's username to their email address through PHP

I am working on a project that involves retrieving usernames based on user emails from a database. I have set up a form where users can enter their email to receive their username, and below is the code I am currently using: <html> <body> &l ...

Tips for showcasing HTML code retrieved from a fetch request in a Vue component

Trying to integrate HTML code received from an API into my VueJS code. The API provides the following: <p>blah blah blah</p> <ul> <li> 1 </li> <li> 2 </li> </ul> Saving this code snippet into a variable, but ...

Aligning the tooltip element vertically

I've created a unique flexbox calendar layout with CSS tooltips that appear on hover. One challenge I'm facing is vertically aligning these tooltips with the corresponding calendar dates effectively. Although I prefer to achieve this alignment u ...

Issue with bouncing dropdown menu

I am in the process of enhancing a Wordpress website by implementing a jQuery menu with sub-menus. Below is the jQuery code snippet: $(document).ready(function(){ $('.menu > li').hover(function(){ var position = $(this).position(); ...

Maintain the anchor's appearance when it lacks an href attribute

I have created an anchor element that I'm using with a button role, so I haven't included the href attribute. <a (click)="doSomething()" role="button">Some data></a> When no href is set on an anchor element in Bootstrap, it lose ...

How can I customize the color of the Title Component in Ant Design using Styled Components?

I am currently integrating Ant Design with styled components in my project. One of the components in my application is a NavBar that includes an H1 Component. H1.tsx import React from 'react'; import { Typography } from 'antd'; impor ...

Boxes rest gently against each other

Hello everyone! I'm currently working on a website for one of my college projects, and I could really use some assistance. I seem to have two boxes touching each other when I actually want a small gap between them. Any help or suggestions would be gre ...

What steps do I need to take to create a calendar with this appearance?

I am working on my college project website and I would like to display a calendar similar to this. How can I achieve this using CSS and JavaScript? I want the user to be able to hover over a date to see all dates of the month, as well as have options to se ...

Checkbox and radio buttons in JQuery UI are stacked vertically on top of each other, rather than adjacent to each other

Here is the HTML code snippet: <div id="container"> <div id="signals-summary-parameters-radio"> <fieldset> <legend>Row Filter : </legend> <label for="signals-summary-radio-all">All</label> ...

Adding a div to the preceding div based on matching IDs in AngularJS

Here is a representation of my layout in HTML: <div ng-repeat="message in messages"> <div ng-class="{'messages messages--sent': userId == message.id, 'messages messages--received': userId != me ...

Guidelines for displaying JSON data in HTML <ul><li></li></ul> format using jQuery within an ASP.NET environment

I am currently developing an asp.net application that involves fetching data from a database in JSON format and displaying it within html ul-li tags using jQuery. Below is a snippet of my Html Page: <html xmlns="http://www.w3.org/1999/xhtml"> <he ...

Looking to extract a particular set of information from past records in a GAS web application

Regarding a previous query I made before (Check for login username and password, and then bring data from every previous entry). I've developed a web application to monitor the working hours of employees at my organization. The app is straightforward ...

Transfer the text link to the following page

In the web project I'm working on, I created a tagcloud. The goal is when a user clicks on a tag, it should redirect to the page showRecipesFromTags.php. <form name="tagform" id="tagform" method="get" action="/showRecipesFromTags.php"> <?php ...

receiving a drop event following a drag leave in HTML5

When participating in HTML5 DnD events to receive files dragged from the desktop, I have encountered an issue where I always receive a dragleave event just before the drop event. This behavior is not mentioned in the specification, and if one uses the drag ...

Using AngularJS to differentiate between desktop and mobile devices, as well as determine if the connection is wifi or not

After some research on SO, I couldn't find similar Q&A about detecting connection types rather than just if a connection exists or not. The goal of my website is to automatically play a video clip based on the user's device and network statu ...

Center the div vertically

How can I vertically center a div next to a tall image using CSS? The left column (#watch) is an image and the right column (#watch-column) is a div that needs to be centered. I've tried different methods but nothing seems to work with my somewhat flu ...

configuration of file types

While using Ipage as my web host, I encountered an issue with an Html document on my server. The problem arose because a json.z file was being read by the browser as "text/html" instead of "application/json; charset=UTF-8", as confirmed in fiddler. Is the ...