Shadow border added to each div creates a unique navigation tab for easy access

#container {
  position: fixed;
  height: 100%;
  left: 0px;
  right: 0px;
  top: 0px;
  width: 10%;
  background-color: blue;
}

#container>div {}
<html>
<div id="container">
  <div>up</div>
  <div>down</div>
  <div>left</div>
  <div>right</div>
</div>

</html>

Is there a way to ensure that each of the div elements within #container are displayed inside yellow boxes that match the length of the container, regardless of the number of divs present?

Answer №1

Give this code a shot

#menu {
  position: absolute;
  height: 100%;
  left: 10px;
  right: 0px;
  top: 20px;
  width: 15%;
  background-color: green;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#menu>div {
    padding: 12px 8px;
    border: 1px solid pink;
    background: orange;
    height: 100%;
}
<div id="menu">
    <div>up</div>
    <div>down</div>
    <div>left</div>
    <div>right</div>
</div>

Answer №2

Is this what you are searching for?

#nav {
  position: fixed;
  height: 100%;
  left : 0px;
  right: 0px;
  top  : 0px;
  width: 10%;
  background-color: blue;
}

#nav div {
  background-color:yellow;
}
<div id="nav">
        <div>up</div>
        <div>down<div>
        <div>left</div>
        <div>right</div>
    </div>

Answer №3

To achieve the desired layout, consider using position:relative for #nav and position:absolute with a width of 100% for the div elements.

Answer №4

#nav {
  position: fixed;
  height: 100%;
  left : 0px;
  right: 0px;
  top  : 0px;
  width: 10%;
  background-color: blue;
}

#nav div {
  background-color:yellow;
  padding:10px;
  border: 1px solid black;

}
<div id="nav">
        <div>up</div>
        <div>down</div>
        <div>left</div>
        <div>right</div>
    </div>

Answer №5

Your inquiry is quite ambiguous, but based on my research, here is the solution:

#nav {
  position: fixed;
  height: 100%;
  left : 0px;
  right: 0px;
  top  : 0px;
  width: 10%;
  background-color: blue;
}

#nav div {
  background-color: red;
  box-shadow : 0 0 3px 1px #000;
  box-sizing: border-box;
  text-align : center;
}
<div id="nav">
        <div>up</div>
        <div>down<div>
        <div>left</div>
        <div>right</div>
    </div>

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

Using jQuery to dynamically insert an HTML element into a table

I'm trying to insert a hyperlink into an empty HTML table. This function works perfectly fine on Firefox and Chrome, taking only 0.2 seconds to load. However, when I try it on IE9, it takes at least 3 minutes to display the link. The issue seems to be ...

Unable to include below the heading for the images

As I venture into the world of HTML, I am facing a challenge with placing titles below two images. Every time I attempt to add either h or p, the text ends up on the right side instead of below the images. What could I be doing wrong? This is all part of ...

Locate the index of each distinct element within the array

Let's define an array called 'arr' with some elements: [7, 9, 30, 40, 50, 8, 1, 2, 3, 40, 90,2, 88,1] We also have another output array defined as: [0, 1, 2, 3, 4, 5, 6, 7, 8 ,10, 12] I stored this code snippet on a javascript ...

Custom JSX element failing to include children during addition

I have created a unique component in JSX, like this: const CustomComponent = ({content}) => { return <div className={content}></div>; } I am using it as follows: <CustomComponent content={"xyz"}> <p>Some additio ...

The final position of the Angular increment animation does not hold

Is there a way to trigger an animation when the value of countAllOrders changes? Specifically, I am attempting to adjust the margin of a list using keyframes in an Angular animation. Here is my HTML code: <ul class="digits" [@ordersValue]=&q ...

Stop the Enter key from functioning as a mouse click

Whenever an element is focused on and a mouse click action can be triggered, I've observed that the Enter key functions as if you're clicking the mouse left button. This behavior is causing conflicts in other parts of my code, so I need to find a ...

Looking to update properties for elements within the Angular Material 16 mat-menu across the board?

Currently working with Angular Material 16 and I have a question regarding the height of buttons inside the mat-menu element. Here is an example of the code: <button mat-icon-button> <mat-icon>more_vert</mat-icon> </button> ...

I am attempting to create a captivating image for a "jumbotron"

My goal is to achieve a full-width image that stretches across the entire website. Furthermore, I want the image to remain centered and shrink from the sides as the window size decreases. Here's what I've attempted: HTML <div class="site-ban ...

Is it common for content to duplicate when using the 'position: fixed' property in CSS media print?

Consider the following div element: ... <div id='section-to-print'>CONT /*Content*/ </div> ... Accompanied by this CSS code snippet: @media print { * { -webkit-transition: none !important; ...

Do I need to utilize a Form element?

<p>text 1<span>additional information 1</span><span>more details</span></p> <p>text 2</p> <a> hyperlink </a> <button>submit</button> <p>yet another paragraph</p> Greeting ...

Steps for adding a navbar that slides horizontally and overlaps other links on a webpage

I am attempting to design a sliding navigation menu using JQuery. The concept involves having multiple main sections, each with several subsections. When a user hovers over a section, the subsections will expand horizontally. If another section is current ...

Tips for utilizing a dropdown menu in Angular

<div> <label> Categories </label> <select> <option *ngFor = "let category of categories" [value] = "category" (click) = "onCategorySelected( category.name )"> ...

Leveraging a Static HTML landing page template within an Angular 6 application

I currently have an Angular 6 app hosted on example.com, with the dist folder being served on port 5000. Additionally, I have a separate landing page folder with its HTML, CSS, and JS files being served on port 6000 at example.com/welcome. Is there a way ...

How can I implement a scroll bar in Angular?

I am facing an issue with my dialog box where the expansion panel on the left side of the column is causing Item 3 to go missing or appear underneath the left column when I expand the last header. I am looking for a solution to add a scroll bar so that it ...

What is the best way to add borders to the cities on interactive SVG maps?

I'm currently developing Interactive SVG Maps showcasing Turkey. The map consists of 81 cities, each represented by <g> elements, and their respective districts, created as child elements within the city elements. It's worth noting that the ...

The JavaScript function modifies the value stored in the local storage

I'm in the process of developing a website that requires updating the value of my local storage when certain JavaScript functions are executed. Currently, I have this code snippet: localStorage.setItem('colorvar', '#EBDBC2'); I&ap ...

Tips for creating an HTML report using Python

Currently, I am searching for a solution to convert my saved matplotlib graphs as png files along with some data frames into HTML format. This is similar to how I typically use R2HTML in R. Despite my efforts, I have not been able to locate clear informat ...

Apply CSS styles to the checkbox

I am new to CSS and I need help styling a checkbox element. When the user selects one of the checkboxes, I want the background color to change to yellow. Thank you for any assistance you can provide! .radio_toggle { float:left; } .radio_toggle label ...

Changing the element tag and flipping escape characters in html entities

My control over the string source is limited, as I can only use html(). However, I am in need of cleaning up the chaos within the source, The goal is to remove all instances of <div class="page"></div>, while retaining its content. The challen ...

Transitioning smoothly from mobile to tablet views with the sidebar activated in Semantic-UI

My HTML includes a pointing menu when the screen width exceeds 630px. Below 630px, it switches to a sidebar with a menu button: <nav class="ui inverted sidebar menu vertical slide out" id="m_menu"> <a href="index.php" ...