putting a div below an absolute positioned element - html

I've got a problem with putting a div below an absolute positioned element which doesn't have a fixed height. The codes are too long to paste here, so I'm posting the link to the html file instead; http://infomailer.kotra.or.kr/20141127/oisy.html
I need to move that 'dd' to the bottom of the document, not using margin or absolute-positioning because this document is to be read by mobile devices as well. What should I do to keep the main structure of tab module and fix the problem?

Related

Absolute positioned element is invisible even when setting high z-index

Code pen showcasing problem.
https://s.codepen.io/NoMan2000/debug/rdPEYJ/xnrabdnqJadA
I apologize for the rather gnarly HTML, but this is output from a next.js project so the bloated mess is part and parcel of that.
Anyway, the problem can be seen in the element #header-menu-buttonList. The idea is pretty simple, a menu that goes underneath the main grid element. But for whatever reason, it just sits there on the page.
You can pick it up in the debug tools and see that it has a width and a height. Messing with its z-index doesn't make the object visible, only removing the position: absolute makes it visible on the page, but that opens up a whole host of other issues.
So, anyone know:
1.) Why the heck it's doing that?
2.) How to either fix it or work around it?
Thanks for the rubber-ducking. :)
So the issue is that the parent element is positioned absolutely, and the child element is positioned absolutely. I'm not up to snuff on all my CSS rules, but this appears to keep it in the DOM but not render it visible.
The solution is to set the child #header-menu-buttonList to position: static and the parent #header-menu-button to position:absolute.

Why is the absolute positioned element not obeying positioning guidelines?

I'm following a tutorial on how to build a website in dreamweaver (https://helpx.adobe.com/dreamweaver/how-to/make-website-pt6-web-links-navigation.html) However I'm trying to understand why a certain step in the tutorial works as it does.
I have an absolutely positioned element #navlink, here's it's position in the DOM structure:
nav
h2 #menulink
ul #navlink
nav
visually looking at the result, ul#navlinks gets removed from the page as per absolute flag, but instead of getting anchored next to the last positioned element, which is the html page (since no element above ul is positioned relative or otherwise) it jumps to the h2#menulink that is above it in dom.
I'm not sure if it's just a mistake in my code and that I am inedvertantly positioning the h2 or nav element in some way, or that I overlooked some other reason of why the document flow attachment point is being overriden, but I cannot find the mistake no matter how many times I go through the code.
This is a link to a full source code as well as the rendered page as I have it in jfiddle:
https://gist.github.com/anonymous/5d8bde1f196b919dab297560ff85b072
This is expected behavior. Your code is correct, and so is the browser. For absolute positioning, it is anchored "next to the last positioned element" horizontally only when left or right property is defined, and vertically only when top or bottom property is defined.
If there is no top, bottom, left or right defined for ul#navlink, it will be "removed from page", but positioned as position: static.

CSS Relative Positioning Issue

To move the position of an image to a certain part of my website, ive put the image in a div tag and used relative position to get it to the place i want it. This works fine for where i want the image to be positioned however there is a downside that it leaves white space behind where it previously use to be and in that space nothing is occupied and it makes the website look ugly. Is there a way to remove that space that it left behind?
as stated above, you should position the element absolute instead. When positioning relative, the element is still within the document flow and therefore occupies its original place in the document. Positioning absolute will remove the element from the flow and make the space available for other elements.
Use absolute positioning instead.

Repeat similar html layout vertically along a page

I have a html layout done using absolutely positioned div elements and a backgroung image. I want to keep the layout the same vertically (each individual part/page representing a data set). I do not wan't to change the div positioning from absolute as this messes up things and I am running out of time for this.
I realize I can have multiple body tags each for every data set and as this html will finally be generated from xml using xslt this is not a problem.
The issue is that as the div elements are absolute they do not appear in the subsequent body tag (only background image appears). I tried changing to relative and the div actually moves to 'next page' (body element), but as there are several divs, when all are laid out they get misaligned.
I will be grateful for some advice on how to tackle this either by fixing my html in some way that will not be too time consuming or by using a tool that can combine several html content in to one flowing page. Any other piece of advice is also very welcome.
From what you've posted, which could really use some of your HTML as an example of what you're trying to do exactly, you should be able to simply wrap each of your "pages" in a div with the position: relative CSS style.
The inner content will then be positioned absolutely from the boundaries of its parent wrap. You would then want to move most of the styles you currently have applied to your body element (like a background image) to the wrapper divs.
Basic example: http://jsfiddle.net/AsWCN/2/

relative positioning of div

Basically, I have a form, outside of that form in this random space on my page I want to position a div (containing two buttons). I've looked at using absolute positioning. However, it is positioning it outside of the page wrapper.
How can I get the positioning to be specified from the corner point of the actual page and not the window?
How can I get the positioning to be
specified from the corner point of the
actual page and not the window?
You need to add position: relative to the element you would like the top and left values to be offset from.
That might be your form, or it might be your #container/#wrapper element.
See here for details and a visual: http://css-tricks.com/absolute-positioning-inside-relative-positioning/
Looks like you have your answer by now. But ill post this anyways.
A simple and short example which shows how relative positioning to parent is done.
http://jsfiddle.net/EadXw/
If you want it positioned top:0;left:0 on the page, place it immediately after the <body> tag.
If it is wrapped in anything the containers may change it's position. Make sure it is independant and not influenced by any containers.
Sounds like you should read up a bit on the flow of the DOM.
Positioning with CSS and HTML
Make sure your <form> element wraps your whole "page" and that the <div> with the buttons is the first child of <form>.
When you do this you can add the rule position:relative to the form and position:absolute to the <div> and move it around with top and left.
Another option is to have no position rule on the form and have position:relative on the <div>. This is more compatible with iPad and iPhone devices, which don't like absolute positioning. When you go for this approach be sure to have a fixed height for the <div> and a negative margin-bottom of the same size.