Styling the Menu Item with CSS

A graphic designer provided me with these elements to incorporate into the HTML design.

Everything was going smoothly until I encountered the faint, uneven borders on the LI tags, especially when dealing with a list containing only five items.

If anyone can guide me on the best way to address this issue using SASS/CSS, that would be greatly appreciated! Please refer to the provided links for more information. The rest of the styling is fine; it's just those small, irregular borders causing concern. My goal was to create a fluid layout where removing the 6th li item from the unordered list transitions seamlessly between two figures.

Here is my current HTML code:

<div class="full-screen-nav">
   <div class="container main-nav">
     <div class="col-xs-12">
        <ul class="menu">
            <li class="menu_item"><a href="#clickme"><span class="menu_itemText">Products</span></a></li>
            <li class="menu_item"><a href="#"><span class="menu_itemText">Learn</span></a></li>
            <li class="menu_item"><a href="#"><span class="menu_itemText">Manage</span></a></li>
            <li class="menu_item"><a href="#"><span class="menu_itemText">Advice</span></a></li>
            <li class="menu_item"><a href="#"><span class="menu_itemText">News</span></a></li>
            <li class="menu_item"><a href="#"><span class="menu_itemText">Retirement</span></a></li>
        </ul>
     </div>
   </div>
</div>

And here is my SCSS code:

// Universal Styles for Full Page nav elements
.full-screen-nav {
    background-color: $slate;
    position: fixed;
    top: 0px;
    left: 0px;
    height: 100%;
    width: 100%;
    z-index: 2;
    color: #fff;

    ul {
        margin: 0;
        padding: 0;

        li {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
    }

    .menu {
        font-size: 0;
        padding: 0;
        margin: 0;

        .menu_item {
            font-size: 10pt;
            width: 33%;
            display: inline-block;
            color: #FFF;
            text-align: center;
            border-right: 1px solid rgba(255, 255, 255, 0.3);
            border-bottom: 1px solid rgba(255, 255, 255, 0.3);
            position: relative;

            .menu_itemText {
                padding: 100px 0 10px 0;
                display: inline-block;
            }

            &:nth-child(3n){
                border-right: 0;
            }

            &:nth-child(n+4){
                border-bottom: 0;
            }

            &:nth-child(4):after, &:nth-child(5):after {
                content: "";
                color: red;
                position: absolute;
                right: -16px;
                background: $slate;
                padding: 16px;
                top: -16px;
            }
        }
    }
}

// Unique Navigation
.unique-nav {
    .container {
        background-color: transparent;
    }

    h2 {
        background: url(#{$assets}/icons/chevron.svg) no-repeat 0 0;
    }

    .menu {
        li {
            background-repeat: no-repeat;
            background-size: 70px;
            background-position: center 20px;

            &:first-child {background-image: url(#{$assets}/menu/products.svg) }
            &:nth-child(2) {background-image: url(#{$assets}/menu/products.svg) }
            &:nth-child(3) {background-image: url(#{$assets}/menu/manage.svg) }
            &:nth-child(4) {background-image: url(#{$assets}/menu/investments.svg) }
            &:nth-child(5) {background-image: url(#{$assets}/menu/news.png) }
            &:nth-child(6) {background-image: url(#{$assets}/menu/retirement.svg)   }
        }
    }
}

Thank you!

https://i.sstatic.net/DxsBR.png

https://i.sstatic.net/18r0O.png

Answer №1

Wow, this may seem a bit intricate...but how about experimenting with the following:

table { 
    border-collapse: collapse;
    border-spacing: 10px;
}

Answer №2

This solution offers a fluid design using only CSS. It utilizes 4 span elements for each corner, with the option to use pseudo elements :before and :after for the top corners, and one span element at the bottom, also allowing for pseudo elements for the bottom corners.

body {
  background-color: rgb(30, 30, 30);
  color: rgb(200, 200, 200);
  font-family: Sans-Serif;
}

.iconbox {
    width: 80%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
  
    display: -webkit-box;
  
    display: -webkit-flex;
  
    display: -ms-flexbox;
  
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
        -ms-flex-direction: row;
            flex-direction: row;
    -webkit-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
            flex-wrap: wrap;
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
        -ms-flex-pack: start;
            justify-content: flex-start;
    -webkit-align-content: flex-start;
        -ms-flex-line-pack: start;
            align-content: flex-start;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
        -ms-flex-align: start;
            align-items: flex-start;
    overflow: hidden;
}

.iconbox li {
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
      -ms-flex-direction: row;
          flex-direction: row;
  -webkit-flex-wrap: wrap;
      -ms-flex-wrap: wrap;
          flex-wrap: wrap;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-align-content: center;
      -ms-flex-line-pack: center;
          align-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 100px;
      -ms-flex: 1 1 100px;
          flex: 1 1 100px;
  height: 100px;
  background-color: rgb(30, 30, 30);
  color: #FFFFFF;
  color: rgba(255, 255, 255, .9);
  border: 1px solid #FFFFFF;
  border: 1px solid rgba(255, 255, 255, .3);
  margin: -2px;
}

.iconbox li .edges-top-right {
  display: block;
  position: absolute;
  width: 20px;
  height: 20px;
  top: -3px;
  right: -2px;
  background-color: rgb(30, 30, 30);
}

.iconbox li .edges-top-left {
  display: block;
  position: absolute;
  width: 20px;
  height: 20px;
  top: -3px;
  left: -2px;
  background-color: rgb(30, 30, 30);
}

.iconbox li .edges-bottom-right {
  display: block;
  position: absolute;
  width: 20px;
  height: 20px;
  bottom: -2px;
  right: -2px;
  background-color: rgb(30, 30, 30);
  z-index: 100;
}

.iconbox li .edges-bottom-left {
  display: block;
  position: absolute;
  width: 20px;
  height: 20px;
  bottom: -2px;
  left: -2px;
  background-color: rgb(30, 30, 30);
  z-index: 100;
}
<ul class="iconbox">
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Products
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Learn
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Manage
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Advice
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    News
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Retirement
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Investments
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
  <li>
    <span class="edges-top-right"></span>
    <span class="edges-top-left"></span>
    Specials
    <span class="edges-bottom-right"></span>
    <span class="edges-bottom-left"></span>
  </li>
</ul>  

CODEPEN EXAMPLE
Try adjusting the browser width to see the fluid effect in action.

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

Activate Vuetify to toggle a data object in an array list when the mouse hovers over

I'm currently working on a project where I need to toggle a Vuetify badge element for each item in an array when the containing div is hovered over. While I've been able to achieve a similar effect using CSS in a v-for loop with an array list, I ...

Sending files through ajax with php

Hey there! I've been working on uploading files using Ajax and PHP, following a tutorial. Here's the code I have so far: upload.js: var handleUpload = function (event){ event.preventDefault(); event.stopPropagation(); var fileInput= document.ge ...

Is there a way to plot countries onto a ThreeJS Sphere?

Currently engaged in a project involving a 3D representation of Earth. Successfully created a 3D Sphere using ThreeJS ...

Button triggered page refresh after Ajax content load

After using AJAX to load a page into a div, everything seems to be working as expected. However, I'm encountering an issue where clicking on buttons within the loaded content causes the entire page to refresh unexpectedly. This behavior is inconsisten ...

Could the autofill feature in Chrome be turned off specifically for Angular form fields?

Even after attempting to prevent autofill with autocomplete=false and autocomplete=off, the Chrome autofill data persists. Is there a method to disable autofill in Angular forms specifically? Would greatly appreciate any recommendations. Thank you. ...

Tips for managing and loading data into a dataGrid or table with the help of ReactJS and ReactHooks

Struggling to retrieve user input data from the form and display it in the table/Datagrid below, without success. Follow the process flow outlined below Once the user submits the form and clicks the send now button, the {handleSubmit} function is trigger ...

Attempting to trigger CSS transitions using JavaScript will not be successful

I'm facing an issue where CSS transitions do not work as expected when triggered by JavaScript. let isSearchBarOpen = false; function toggleSearchBar() { if (isSearchBarOpen) { searchBar.style.display = "none"; } else { searchBar.sty ...

Conceal or eliminate redundant choices in dropdown menu

I am currently working with the WebForms framework and I have encountered an issue with my dropdownlist control in one of my Forms. The Select option is sometimes being added twice, causing duplication in my form. I am looking for a way to either remove th ...

Restoring a position following a jQuery animation

After animating an element, I'm struggling to reset its CSS position back to its original state. I've experimented with stop(), queue:false, and specifying the desired css position after the animation finishes, but none of these approaches seem ...

The scrolling function halts as soon as the element that was middle-clicked is deleted from the

I am knee-deep in developing my own React virtualization feature and encountering a minor annoyance. When I middle click on an item in the list and start scrolling, the scrolling stops once that item is removed from the DOM. My initial thought was that the ...

Is it feasible to incorporate one iOS app within another iOS app through in-app purchasing or subscription?

Simply put, we are creating interactive content in Flash that we want to distribute through an iOS app either by in-app purchase or subscription. In our testing, we have found that Flash can produce standalone iOS apps that work well for our needs. Instea ...

What methods are available for managing model fields within a for loop in Django?

As a newcomer to Django, I am embarking on the journey of creating a Quiz web application that presents one question at a time. Upon selecting an answer using radio buttons, the application should promptly display whether the response is correct or incorre ...

When using the Infinite Scroll React component, only a single new set of objects is loaded as you scroll down, and the loading

My React component is designed to load 6 images at a time as the page is scrolled down, creating an infinite scroll effect similar to what YouTube and Reddit now use. Currently, when the page loads, it shows the initial 6 images correctly. However, as I c ...

What fate befalls CSS rules left untouched?

Within my style.css file, I have applied rules to almost every component on the website. However, there are exceptions such as the main template and sections displaying requested pages which may contain unique parts not found in other pages, utilizing the ...

CSS: The sub-class functionality is not functioning as intended

Having trouble with this HTML element : <span class="item-menu-notif non-lue" onclick="dosomething(2150)"> TEXT </span> These are the CSS classes : .item-menu-notif{ display: block; cursor: pointer; padding: 0 0.4em 0 0.4em; } s ...

AngularJS checkbox ng-repeat directive not displaying controller data

I am facing an issue with rendering checkbox data from the Controller file in my HTML. Here is the code snippet: HTML: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script& ...

How to access bespoke attributes in Scene Builder using JavaFX?

I am on the hunt for a way to designate customizable properties for my custom controls. Jens Deters has already created some fantastic custom controls utilizing fontawesomefx for JavaFX. Once you import the jar files into Scene Builder, you can easily inc ...

Sending lambda expression to controller via ajax request

I'm curious if it's achievable to send a lambda expression from the view to the controller. For instance, imagine I have a model: public class CustomExpressionModel<T> { public Expression<Func<T, string>> Expression { get; ...

'Dynamic' styling in Next.js using conditional CSS

I am exploring ways to style elements based on their parameters. I have been searching for terms like "conditional css react" and "implementing conditional styles in react with css". Here is a snippet of my code: e.g. <div class="ChatComponent_ ...

A lesson is what I'm seeking, as I face an Uncaught TypeError: Unable to locate the property 'split' of an undefined value

Although this question has been asked multiple times before, I am a beginner and eager to learn. I would greatly appreciate it if someone could take the time to explain this to me. I have tried to find a solution to this error using the existing answers, b ...