Menu positioned offscreen in the bottom right corner

Trying to position the following code on the right side of the nav-bar, but it's only displaying half of the menu correctly. No additional CSS has been added, this is using the default material design lite code.



The issue seems to be with my CSS https://codepen.io/russellharrower/pen/RgMJaR

My core getmdl

<link rel="stylesheet" href="https://getmdl.io/assets/components.css">
<script src="https://getmdl.io/assets/components.js"></script>
<script src="//code.getmdl.io/1.3.0/material.min.js"></script>

HTML CODE

            <div class="mdl-layout__header-row">
                <!-- Title -->
                <span class="mdl-layout-title">SITE</span></span>
                <!-- Add spacer, to align navigation to the right -->
                <div class="mdl-layout-spacer"></div>
                <div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield--floating-label mdl-textfield--align-right">
                    <label class="mdl-button mdl-js-button mdl-button--icon" for="fixed-header-drawer-exp">
                        <i class="material-icons">search</i>
                    </label>
                    <div class="mdl-textfield__expandable-holder">
                        <input class="mdl-textfield__input" type="text" name="sample" id="fixed-header-drawer-exp" />
                    </div>
                </div>

                 ≪- MDL bottom right Aligned Menu Button -->  
             <button id="my-menu-bottom-right"
                    class="mdl-button mdl-js-button mdl-button--icon">
              <i class="material-icons">share</i>
            </button>

            <!-- Menu items List , mdl-menu--bottom-right -->

            <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
                for="my-menu-bottom-right">
              <li class="mdl-menu__item">Facebook</li>
              <li class="mdl-menu__item">Twitter</li>
              <li disabled class="mdl-menu__item">Google Plus</li>
            </ul>

            </div>

        </header> 

https://i.sstatic.net/LzRKc.jpg

This automatically generated CSS seems to be causing issues, not sure what part of the code generates it or why.

element.style {
    right: -35.1563px;
    top: 40px;
    width: 124px;
    height: 160px;
}

Error discovered in:

.mdl-textfield{width:100% !important;}

I need to style it without affecting all .mdl-textfield globally, so I'll target the #id of the div before instead.

Answer №1

mdl-menu--bottom-left has been switched to mdl-menu--bottom-right in the menu ul

Check out this code snippet on CodePen.

<header class="mdl-layout__header">

            <div class="mdl-layout__header-row">
                <!-- Title -->
                <span class="mdl-layout-title">SITE</span></span>
                <!-- Add spacer, to align navigation to the right -->
                <div class="mdl-layout-spacer"></div>
                <div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield--floating-label mdl-textfield--align-right">
                    <label class="mdl-button mdl-js-button mdl-button--icon" for="fixed-header-drawer-exp">
                        <i class="material-icons">search</i>
                    </label>
                    <div class="mdl-textfield__expandable-holder">
                        <input class="mdl-textfield__input" type="text" name="sample" id="fixed-header-drawer-exp" />
                    </div>
                </div>

                 <!-- MDL bottom right Aligned Menu Button -->  
                 <button id="my-menu-bottom-left"
                        class="mdl-button mdl-js-button mdl-button--icon">
                  <i class="material-icons">share</i>
                </button>

                <!-- Menu items List , mdl-menu--bottom-right -->
                <!-- mdl-menu--bottom-left to mdl-menu--bottom-right  -->
                <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
                    for="my-menu-bottom-left">
                  <li class="mdl-menu__item">Facebook</li>
                  <li class="mdl-menu__item">Twitter</li>
                  <li disabled class="mdl-menu__item">Google Plus</li>
                </ul>

            </div>

        </header> 

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

Tips for dynamically changing the color of a React Native style based on data conditions

Just starting with react native. I'm working on a basic quiz feature for my app. I've created an api that provides questions, answers, and a boolean value indicating the correct answer, Something like this : { "question:"Demo quest ...

Guide on separating a Chart.js chart with reactive attributes into its own component in Svelte

After creating a Skeleton Project using the command npm create svelte@latest myapp, I proceeded to install Chart.js with npm install svelte-chartjs chart.js and then created a basic bar chart: <script> import { Bar } from 'svelte-chartjs' ...

Vue 2 failing to retain component data upon page refresh

I've encountered a peculiar issue with Vue (v2.6.14) where I'm trying to create a new array based on one received as a prop. Here's the code snippet that's causing the trouble: props: { employees: Array }, data() { return { sorted ...

The function was not invoked as expected and instead returned an error stating "this.method is not

I need help with an issue in my index.vue file. The problem lies in the fancy box under the after close where I am trying to call the messageAlert method, but it keeps returning this.messageAlert is not a function Can someone please assist me in resolving ...

JavaScript document string separation

Hi there, I'm a newbie here and could really use some assistance. I am struggling with creating a function and would appreciate any ideas... To give you an idea of what I need help with, I have a String and I want to check if it contains a specific w ...

Issue with Mongoose not triggering callback

This particular function is the one that we are discussing function matches_password(password) { var modified = false; var matched = false; User.count({password : password}, function (err, result) { modified = true; console.log('hey& ...

Puzzling blank area found beneath the form component

There seems to be some extra space at the bottom of a form when it's placed inside a div. How can we remove that unwanted space? In examples from stack overflow, the extra space is not visible in the code snippets provided. However, it appears elsewh ...

What is the recommended way to configure the build.gradle file for the app build process?

I am currently working on building the app using the command provided below. /android gradlew assembleRelease My main query at this point is whether it is necessary to eliminate the debug of signingConfigs and debug of buildTypes when transitioning into r ...

Leveraging environment variables within a React app

Just when I thought I had a handle on things, our JavaScript resource decided to quit. Now, as someone with zero knowledge of front-end development, I find myself in charge of getting the UI up and running. My current hurdle involves using an environment v ...

How can I prevent an image from scrolling on a webpage?

I am seeking a way to prevent an image from scrolling along with the rest of the page. I want the image to occupy a specific percentage of width, while allowing the browser to determine the appropriate height for display. The image's height should als ...

Is misbehavior expected at approximately 600 pixels in width?

What is happening with my website when the width is minimized, and how can I resolve it? Issue The website appears fine on mobile devices and full screens, but at reduced sizes, the background image disappears and the top bar behaves strangely (with the l ...

The issue with depth arises when rotating the camera in threejs

As someone new to the world of threejs, I have created a sample showcasing an issue for better understanding. Feel free to check out the sample here. In this demonstration, you'll notice that dragging the stage horizontally causes the cube and capsu ...

Summing an Array in Javascript

I am having trouble calculating the sum of an array in my code. Instead of adding up all the numbers, it is concatenating them together. For example, if I have grades 90, 95, and 100, the sum shows as 09590100. The first FOR loop successfully pushes the ...

"The event triggers the function with an incorrect parameter, leading to the execution of the function with

Currently, I am working with a map and a corresponding table. The table displays various communities, each of which has a polygon displayed on the map. My goal is to have the polygons highlighted on the map when hovering over a specific element in the tabl ...

Updating information within an ArcGIS Service using REST and JSON using jQuery/JavaScript

I've been attempting to update information in a feature within an arcgis service using REST and JSON. I've created a function that is supposed to be called, but the output I'm receiving is not providing me with any clear direction. I am als ...

Scraping Secrets: Unraveling the Art of Procuring User Links

I need assistance with extracting links from the group members' page on Meetup: response.css('.text--ellipsisOneLine::attr(href)').getall() Can you please help me understand why this code is not functioning correctly? This is the HTML stru ...

Is there a backend-exclusive solution for scheduling periodic function calls without using JavaScript?

In the JavaScript file that I have included in the main .cshtml page of my ASP.NET MVC application, the following code can be found: var ajax_call = function () { $.ajax({ type: "GET", cache: false, url: "/Session/Index/", ...

The Enigma of the Empty Gap When Employing "display:table/table-cell"

Struggling to understand why there is a blank space between the image and the menu. Here is the HTML and CSS related to it: <header class="header_nav"> <img src="img/logo.png" class="logo"/> <nav class="nav_bar"> <u ...

Eliminate the JSON object within jqGrid's posted data

The web page I'm working on features Filters with two buttons that load data for jqGrid when clicked. Clicking 'Filter' generates a postData json object and sends it to the server, which is working perfectly. However, I'm facing an is ...

Exporting variables in Angular's Ahead of Time (AoT) compiler is

I recently attempted to incorporate dynamic configuration into my project, following a guide I found in this insightful post. While everything functions smoothly with the JiT compiler, I encountered the following error when attempting to build using the A ...