Issue with spacing dropdown choices within primary navigation bar

Struggling with my final project for a class as the semester comes to a close. I've received minimal help from my Professor and hit a roadblock. The main navigation on the side is working correctly, but the dropdown options are stacking on top of each other despite being rotated correctly. I've tried various solutions but can't seem to get them spaced properly. Any suggestions or assistance would be greatly appreciated. Thank you.

#rotate-text {
    text-align: center;
   width: 25px;
   transform: rotate(270deg);
}

.navbar{
    overflow: hidden;
    background-color: aliceblue;
    font-family: cursive;
}
/* Style the links inside the navigation bar */
.topnav a {
    transform-origin: top left;
    transform: rotate(-90deg) translateX(-100%);
    font-family: 'Bevan', cursive;
  float:left;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
font-weight: bolder;
  font-size: 20px;
}
.dropdown{
    float: center;
    overflow: hidden;
}
.dropdown .dropbtn {
    transform-origin: top left;
    transform: rotate(-90deg) translateX(-100%);
    font-family: 'Bevan', cursive;
    float:left;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-weight: bolder;
    font-size: 20px;  
    border: solid;
    outline: none;
    background-color: inherit;
}
.dropdown-content {
      display: none;
      position: absolute;
      min-width: 160px;
      z-index: 1;
    left: 70px;
}
.dropdown-content a {
      float: none;
      color: #f2f2f2;
      padding: 12px 16px;
      text-decoration: none;
      display: block;
      text-align: left;
}

.dropdown:hover .dropdown-content {
  display: block;
}
/* Change the color of links on hover */
.topnav a:hover {
  color:aqua
}
.topnav a.active 
    {
        border-color: cadetblue;
    }
/*-90 rotate
.topnav a: rotate {
    transform: rotate(-90deg);
}
<html>
    <head>
        <link href='finale.css' rel='stylesheet'/>
        <style>
            body{
                background-image: url(BGGradient.png);
                background-repeat:no-repeat;
            }
            #title{
                text-align: center;
                font-family: cursive;
                font-size: 36pt;
                font-weight: bolder;
                color: #f2f2f2;
            }
            #base{
                border: solid;
            }
        </style>
    </head>
    <body>
        <div id="title">
            Zurion Oasis
        </div>
        <div>
            <table height=100% width=100%>
                <tr>
                    <td>
                        <table height=100%>
                            <tr>
                                <td class="topnav" style="height:100px">
                                    <a href="#contact">CONTACT</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="topnav" style="height:100px">
                                    <a href="#about">ABOUT</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="topnav" style="height:100px">
                                    <div class="dropdown" id="work">
                                        <button class="dropbtn">WORK
                                          </button>
                                        <div class="dropdown-content">
                                           <a href="#">Photography</a>
                                              <a href="#">Digital</a>
                                              <a href="#">Physical Medium</a>
                                        </div>
                                      </div> 
                                </td>
                            </tr>
                            <tr>
                                <td class="topnav" style="height:100px">
                                    <a class="active" href="#home">HOME</a>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        <div id="base">
                        REST OF PAGE GOES HERE
                        </div>
                    </td>
                <tr>
            </table>
        </div>
    </body>
</html>

Screen of visual

Answer №1

To eliminate the stacking issue, you should modify these two CSS properties in your code.

<html>
<head>
    <link href='finale.css' rel='stylesheet'/>
    <style>
        body{
            background-image: url(BGGradient.png);
            background-repeat:no-repeat;
        }
        #title{
            text-align: center;
            font-family: cursive;
            font-size: 36pt;
            font-weight: bolder;
            color: #f2f2f2;
        }
        #base{
            border: solid;
        }
    </style>
</head>
<body>
    <div id="title">
        Zurion Oasis
    </div>
    <div>
        <table height=100% width=100%>
            <tr>
                <td>
                    <table height=100%>
                        <tr>
                            <td class="topnav" style="height:100px">
                                <a href="#contact">CONTACT</a>
                            </td>
                        </tr>
                        <tr>
                            <td class="topnav" style="height:100px">
                                <a href="#about">ABOUT</a>
                            </td>
                        </tr>
                        <tr>
                            <td class="topnavv" style="height:100px" style="">
                                <div class="dropdown" id="work">
                                  <span class="dropbtn">WORK</span>
                                  <div class="dropdown-content">
                                        <a href="#"><p>Photography</p></a>
                                        <a href="#"><p>Digital</p></a>
                                        <a href="#"><p>Physical Medium</p></a>
                                  </div>
                                </div>


                            </td>
                        </tr>
                        <tr>
                            <td class="topnav" style="height:100px">
                                <a class="active" href="#home">HOME</a>
                            </td>
                        </tr>
                    </table>
                </td>
                <td>
                    <div id="base">
                    REST OF PAGE GOES HERE
                    </div>
                </td>
            <tr>
        </table>
    </div>
</body>
  </html> 

and css:

/* Style the links inside the navigation bar */
  .topnav a {
      transform-origin: top left;
      transform: rotate(-90deg) translateX(-100%);
      font-family: 'Bevan', cursive;
      float:left;
      color: #f2f2f2;
      text-align: center;
      padding: 14px 16px;
      text-decoration: none;
      font-weight: bolder;
      font-size: 20px;
      }

      .topnavv{
       font-family:'Bevan',cursive;
       color: #f2f2f2;
       text-decoration: none;
       font-weight: bolder;
       font-size:20px;
       text-decoration: none;
       vertical-align: inherit;
      }
      .topnavv a{
        transform-origin: top left;
        font-family:'Bevan',cursive;
        color: #f2f2f2;
        text-decoration: none;
        font-weight: bolder;
        font-size:20px;}
      .dropdown {
        position: relative;
        display: inline-block;
        transform: rotate(-90deg) translateX(-50%);}
      .dropdown-content {
        display: none;
        position: absolute;
        background-color: #f9f9f9;
        min-width: 160px;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        padding: 12px 16px;
        z-index: 1;
      }

      .dropdown:hover .dropdown-content {
        display: block;
      }

      /* Change the color of links on hover */
      .topnav a:hover {
        color:aqua
      }
      .topnav a.active
          {
              border-color: cadetblue;
          }
      /*-90 rotate
      .topnav a: rotate {
          transform: rotate(-90deg);
      }

Result: https://i.sstatic.net/OuXTi.png Edit: Updated the file for proper css.

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

Exploring the reasons for utilizing class and ID selectors within a <div> element to enclose a map in OpenLayers

The 'quickstart' guide provides a comprehensive overview of using id and class css selectors within the html code. In order to link the map object to a specific div element, a target is required as an argument for the map object. This target val ...

Problem arises when attempting to display a div after clicking on a hyperlink

I'm encountering an issue with displaying a div after clicking on a link. Upon clicking one of the links within the initial div, a new div is supposed to appear below it. All tests conducted in jsfiddle have shown successful results, but upon transf ...

Creating an image gallery with animated effects: A step-by-step guide

I am looking to develop a creative image gallery with animated effects. I also want to include panels and hyperlinks for each image, similar to the functionality on this website: http://www.microsoft.com/en-lk/default.aspx Can anyone guide me on how to ac ...

Is it possible for CSS in React to cause the vanishing of all buttons

I'm encountering an issue where the CSS styling applied to every button in my NavBar is causing a specific button labeled 'Search' to disappear when it shouldn't. The problem stems from NavBar.css, which contains a media query that unin ...

The waveform's bottom appears distorted when using Bootstrap

I'm currently experimenting with creating a header wave in Bootstrap CSS using SVG shape. However, I encountered an issue when implementing bootstrap into the HTML code - my design resembles the second image instead of the desired look of the first on ...

`problem with moment.js incorrectly identifying the day of a given date`

I'm currently working with a field that has the value 03-01-2020, which is in the DD-MM-YYYY date format. However, when I apply the code moment.utc(document.getElementById('date').value, "DD-MM-YYYY HH:mm:ss").toDate(), I noticed that the re ...

Utilizing data attributes in E2E testing for optimal results

We have decided to transition from using tag and classname selectors to data attributes in Cypress for our E2E testing. This change is intended to make the selectors more robust and less prone to breaking. Specifically, Cypress recommends using data-cy, d ...

The issue I'm facing is that the ng-click functionality in Angular JS is not functioning properly when the

Upon loading the page, my JavaScript function creates a tree structure from JSON data and generates a list of anchor tags which look like this: <a ng-click="shareParent(4619)">Some data</a> Despite associating the ng-click directive with the ...

Ways to easily modify images using a single button with the help of jq

I am new to programming and eager to learn... Currently, I am facing the following problem: I would like to create a functionality where three images can be changed using one button and incorporating fadeIn and fadeOut animations. Essentially, all images ...

Modifying an image with jQuery

Why won't this image change? Below is the relevant HTML, CSS, and jQuery code. HTML <nav id="desktop-nav"> <div class="logo"> <a href="#"></a> </div> <div> ... </div> ... CSS nav#desktop-nav . ...

Using WebDriver to select and interact with a hyperlink on a website

I am currently attempting to select a specific link on a webpage, which happens to be a Home button consistently located in the same position no matter where I navigate. I have been using the driver.findElement(By.xpath("//span/ul/li/a")).click(); command ...

The continuation of unraveling the mystery of utilizing `overflow-y:scroll` in a horizontal slider

As a beginner, I realized too late that adding code in comments is not an option. Consequently, I decided to create a new question and ask for your assistance once again. To optimize the use of space, I have implemented bxSlider with fixed dimensions (wid ...

The Django server fails to display the CSS files upon activation

Despite having all the static files in place, only the plain HTML loads without any styles for some unknown reason. I've attempted using collectstatic and even setting up a new project, but to no avail. STATIC_URL is also properly specified along with ...

Looking for an image that spans the entire height of the container

I need help with positioning an img inside a div container that has a background color. I want the image to overlay on top of the div, extending beyond its height without causing any scroll bars. Here is a fiddle related to this issue: http://jsfiddle.net ...

Increase the identification of HTML element with jQuery

I've encountered an issue while trying to increment the id of 2 HTML elements, hwAddition and itemNumber, upon a button click event. The HTML code in question is as follows: <div id="hwAddition"> <div id="itemNumber" s ...

Changing the color of a specific span using Angular

I am working with a dynamic mat-table where columns are added and populated on the fly. The table headers are styled using divs and spans. My goal is to change the color of a header to black when clicked, but also un-toggle any previously selected header. ...

Modify only unprocessed text within the HTML content

Consider the following string: html_string = '<span><span class=\"ip\"></span> Do not stare <span class=\"img\"></span> at the monitor continuously </span>\r\n' I am looking to ...

Ways to customize CSS styles for a single page?

<head> <link href="index.css" rel="stylesheet"> <style> #amor_di_mundo{ color:#ffffff; } </style> </head> <body> <div id='divL'> <div id='amor_di_mundo'>Amor di Mundo</div> <di ...

Adjusting Size Dynamically for Tooltips Based on Content Length

In my angular app using ng-bootstrap v4.2.1 on an older codebase, I have successfully created a tooltip with some very long sentences as content. I am trying to make the tooltip 800px wide, but when I set the width, only the first few words fill the space. ...

Click on a pricing category when the page is updated with jQuery Ajax

My code is experiencing an issue. When the prices tab is empty, I can select one with a CSS highlight. However, after refreshing the tab using jQuery and ajax, the selection style stops working. Below is my HTML code: $('#subcategories').on(& ...