1

Absolute positioned element - Higher percentage does not work

 3 years ago
source link: https://www.codesd.com/item/absolute-positioned-element-higher-percentage-does-not-work.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Absolute positioned element - Higher percentage does not work

advertisements

What could be the cause for an absolute positioned element to ignore a percentage for the "top" position? Percentages are working for "left", and I can use pixels and vh to position it vertically, just not a percentage.


This is because you have to make the parent of the absolute element - "position: relative". So then the absolute element's top and left fields will get the applied values relative to parent.

Related Articles

Absolute position - div in div does not work

I have div callad subHeader inside I have: 1 - subHeaderLeft 2 - subHeaderRight when i displayed to browser the subHeaderLeft/right are out from subHeader and not inside. why the subHeaderLeft/right are out side from subHeader ? You can see Demo jsFi

The positioning element with jQuery does not work in Internet Explorer 8

I have a set of images inside a div that I position with jQuery on page load. var myimg = $('#myimg'); ... // Calculate x and y myimg.css('left', x); myimg.css('bottom', y); Each image has a position: absolute style, while their containing div has a

CSS: The top percentage does not work on all browsers

I'm aiming to position an image to the middle inside a div. It works great, but for some reason, top doesn't have any effect on the Android browser. Very likely, I have my divs set incorrectly where the img one cannot determine it's container height

The position of a button does not work

I created a button so when I click on it a random card appears. On the random card(s) is an "x". I can't position the "x" in the top right corner and I don't know why it does not work. I want to create a function so that when I click o

Problem moving the entire html page down! The margin-top element to html does not work on all pages

i have a strange css, JS problem. My chrome-extension should move the hole website some pixels down, so i can display a toolbar on top of it. This works for most pages, but doesn't work for a few. And i can't find out what's the problem. The code for

centered navigation with flexible widths left and right - fill percentage does not work

UPDATE: Simplified HTML & CSS as per one of the answers below. The problem is still occurring however. I have a working nav that is something like this: item11item2item3 Centered item4item5item6 I want to add padding between the items so it looks lik

moveToElement (element, xoffset, yoffset) does not work in selenium webdriver 2.32.0

I am trying to use moveToElement(element,xoffset,yoffset) of the Actions class in selenium web driver (java) in FireFox 21. but it seems it is not working. I have a extjs button control which acts as button as well as drop down(please refer screen sh

margin-top percentage does not work as expected

I know what you're thinking, but the parent container(s) are all positioned with pixels. I have a div with a height and width in pixels, inside that div I have a youtube iframe that has (for this example) it's margin-top in percentage. This the HTML:

javascript - onclick everything except some elements; e.target does not work & hellip; sometimes

I have tried to recreate jQuery's native event handler, .click("body", "element, element", function( ... ));. Where if the user clicks on anything but those two elements, it will do something. I've successfully done this, however, some

CSS3 transitions on pseudo-elements (: after,: before) does not work?

I'm showing the title attribute of a link on :hover. The title attribute is appended to the link via :after- Now I'm wondering how I can animate the opacity of the :after pseudo-element when hovering-in and hovering-out. html <a class="link"

Targeting the previous li element of DOM does not work

I cannot get this code to work, but I cannot see what I messed up. My HTML looks like this: <li id="youraccount" class="active"> <a href="#">Your Account</a> <ul class="nav-pills nav-stacked sub-nav

the position of the button does not work as expected

Can anyone explain why the button is not absolute-positioning to the right? I expect it to be 3px from every edge. HTML: <div class="wrapper"> <button>Hello world</button> </div> CSS: .wrapper { height: 300px; width: 300p

Position: The relative branch does not work in Firefox / IE

Basically I have a Picture in a div nested in 2 divs. I wanted to overlay a piece of tape onto it at the corner of the picture. So I made a div for that piece of tape image and put it at the bottom of the document giving it the position of relative a

Using the position: Fixed for navigation does not work as expected

I've created a JSFiddle to show my webpage structure HTML and CSS. http://jsfiddle.net/du7NN/ I've been trying to build a page where when scrolling the navigation sticks to the top of the page while the rest of the reader disappears and rest of the p

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK