Side menu and grid display using HTML and CSS

Looking to revamp the layout of my angularJS website, specifically one page. Currently, information is displayed in a table format but I would like to switch it up by adding a left sidebar featuring a list of names (tiles). When a user clicks on a name, the right sidebar should dynamically show more details about that specific individual. Any tips or suggestions on how to efficiently achieve this using HTML and CSS would be greatly appreciated.

Below is the basic code snippet I have created so far:

body {
  margin: 40px;
}

.lft_sidebar {
  grid-area: sidebar;
}

.content {
  grid-area: content;
}

.header {
  grid-area: header;
}

.wrapper {
  display: grid;
  grid-gap: 10px;
  grid-template-columns: 120px 120px 120px;
  grid-template-areas: "....... header header" "sidebar content content" "footer  footer  footer";
  background-color: #fff;
  color: #444;
}

.box {
  background-color: #444;
  color: #fff;
  border-radius: 5px;
  padding: 10px;
  font-size: 150%;
}

.header,
.footer {
  background-color: #999;
}
<div class="wrapper">
  <div class="header">Header</div>

  <div class="lft_sidebar">Name 1</div>
  <div class="lft_sidebar">Name 2</div>
  <div class="lft_sidebar">Name 3</div>
  <div class="lft_sidebar">Name 4</div>

  <div class="rght_sidebar"> More details about Selected Name</div>
</div>

Answer №1

Utilize the grid-column-start and grid-column-end CSS properties to define the starting and ending positions of a grid cell.

body {
margin: 40px;
}

.lft_sidebar {
    grid-area: sidebar;
}

.left {
   grid-column-start: 1;
   grid-column-end: 2;
}

.rght_sidebar {
   grid-column-start: 2;
   grid-column-end: 4;
}

.header {
   grid-column-start: 1;
   grid-column-end: 4;
}

.wrapper {
    display: grid;
grid-gap: 10px;
    grid-template-columns: repeat(3, 1fr);
   
    background-color: #fff;
    color: #444;
}


.box {
 background-color: #444;
 color: #fff;
 border-radius: 5px;
 padding: 10px;
 font-size: 150%;
}

.header,
.footer {
background-color: #999;
}
<div class="wrapper">
<div class="header">Header</div>


<div class="left">
  <div class="lft_sidebar">Name 1</div>
  <div class="lft_sidebar">Name 2</div>
  <div class="lft_sidebar">Name 3</div>
  <div class="lft_sidebar">Name 4</div>
</div>

<div class="rght_sidebar"> More details about Selected Name</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

jQuery slider - display unlimited images

Currently, I am encountering issues with a Flickity carousel of images. When an image/slide is clicked, a modal window opens to display a zoomed-in version of the image. The problem arises when there are more or fewer than 3 images in the slider — my cod ...

Loading input datalist in Firefox postponed

My goal is to implement an input field for a username that allows users to select from a wide range of names/usernames. I want them to be able to enter a partial string from the name or username. Instead of loading the entire list initially, I aim to load ...

implementing image return functionality in angularjs

I'm currently receiving user details in the server response and I'd like to encode an image from that response to display on my front end. Here's what I have so far: HTML: <img ng-src=data:image/png;base64,{{user_image}}> Angularjs ...

"Watching is not good, so what can we do to improve this situation

In my Angular project, I have been utilizing the $watch function even though it's recommended to avoid doing so. Below is an example of how I've implemented it: $scope.$watch('mysevice.function()', function(tilda) { $scope.valu ...

Can data be transmitted to two separate scripts simultaneously?

Just a quick HTML inquiry: Can data from HTML forms be sent to two separate scripts using the "action" attribute, or is there an alternative method? I'd like to explore other options aside from utilizing curl. ...

Interactive iframe material using $_POST variables

Working with PHP has always posed a challenge for me. Typically, I navigate through by searching and trial and error, but this time I'm stuck. Currently, I'm developing a project that allows users to order services online. The ordering module is ...

How can the border of the select element be removed when it is active in select2

After examining the CSS code, I am still unable to locate the specific property that is being applied to the main element. I am currently customizing the select2 library to suit my needs. However, I am stuck in the CSS as I cannot determine which property ...

Experiencing inconsistencies with CSS on certain devices?

When faced with a research issue, I usually turn to Google for answers. However, this time, I was unsure of where to begin. As part of my efforts to enhance my frontend development skills, I undertook The Odin Project and worked on a calculator project. U ...

Using anchor tags to send HTML code through email

I currently have an anchor tag on my website that looks like this: <a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e0d11131b11101b3e0d11131b09161b0c1b501d1113">[email protected]</a>?subject=Wel ...

Tips for assigning a class to a div based on the route in Angular

In my angular template, I have a basic ng-repeat with some div elements. Now, I am looking to add a class to a specific div if the $routeParams.userId matches the id of the object in the loop. You can refer to the second line of code below for clarificatio ...

Is there a way to incorporate CSS or tables when converting HTML to PDF using JavaScript?

While working on a project, I successfully converted an HTML file into a PDF. However, the output did not display the CSS design. Can anyone provide suggestions on how to include CSS design in the PDF file? Below is the JavaScript function code: $(funct ...

Exploring the capabilities of window opener in AngularJS applications

I am facing an issue with a function that utilizes an API to redirect me to a callback URL. After this redirection, I need to execute a function in my core JavaScript. If I keep the function separate from AngularJS and use window.opener, it works fine. How ...

Comparing response times between AngularJS $http and $.ajax callbacks

I am puzzled as to why AngularJS $http service's success callback is giving me a slower response time compared to the $.ajax success callback. I ran this code 5 times with different JSON files: if(isJquery){ $.ajax({ type : 'GET', ...

What causes the d3 force layout to fail and what steps can be taken to resolve it?

While experimenting with a force layout, I noticed that when I drag an item aggressively, it sometimes causes everything to freeze. This raises the following questions: What is the reason behind this issue? Is there any way to detect this and restart th ...

Is there a way to integrate the javascript and jQuery functions in order to conceal a button?

I recently acquired the File Upload script known as Simple Photo Manager and I am looking to incorporate jQuery functions with the existing JS code in the script. My main goal is to make the Delete button disappear once it has been clicked. However, I am ...

Select from multiple levels in a dropdown menu HTML

I have encountered an issue while developing a website. I am trying to create a hierarchical list with multiple levels, but it seems that such feature does not exist (unless you know otherwise). As a workaround, I have implemented a system using invisible ...

tips for creating a jquery/css scales animation

I am looking to implement a unique feature on my website where I create scales with a balancing effect. The scales should mimic an up and down motion continuously. You can see an example of what I'm referring to here Is there a way in jQuery or CSS t ...

Looking for assistance with resizing and repositioning an image within a viewport?

The JSFiddle code can be found at this link - https://jsfiddle.net/pmi2018/smewua0k/211/ Javascript $('#rotate').click(function(e) { updateImage(90, 0) console.log("rotation"); }); $('#zoom-in').click(function() { updateImage(0 ...

Transclusion with multiple slots in AngularJS

Attempting to incorporate a component in AngularJS 1.5.8 with multi-slot transclusion. The test performs well when utilizing a directive, however, with a component, it appears that the slot cannot be located!. This is how the component is declared app. ...

Automatically adjusting input box size and position in real-time

I am working on a form that includes a button and an input field. When the user clicks on the button "ADD MORE FIELDS," I want to dynamically generate a new input box. Although I have tried using code from this jsfiddle link and it works, my goal is to ach ...