#container { width: 100px; height: 100px; position: relative; } #navi, #infoi { width: 100%; height: 100%; position: absolute; top: 0; left: 0; } #infoi { z-index: 10; }
<div id="container"> <div id="navi">a</div> <div id="infoi"> <img src="https://appharbor.com/assets/images/stackoverflow-logo.png" height="20" width="32" />b </div> </div>
I would suggest learning about position: relative
and child elements with position: absolute
.
Related Posts:
- How to overlay image with color in CSS?
- How to make a monopoly board using css grid?
- How to horizontally center an element
- How do I vertically align text in a div?
- Hide scroll bar, but while still being able to scroll
- How to set a border for an HTML div tag
- How can I center text (horizontally and vertically) inside a div block?
- Setting table column width
- Draw Circle using css alone [duplicate]
- Why does z-index not work?
- Transparent CSS background color
- Is there any way to change input type=”date” format?
- Is
element block level or inline level?
- How to center a “position: absolute” element
- How to line-break from css, without using
? - How to put img inline with text
- How to center a “position: absolute” element
- Set the table column width constant regardless of the amount of text in its cells?
- Two divs side by side – Fluid display
- CSS Display an Image Resized and Cropped
- How do I make a placeholder for a ‘select’ box?
- FontAwesome icons are not showing, Why?
- Remove border from IFrame
- CSS color vs. background-color vs. background?
- How to change text transparency in HTML/CSS?
- CSS horizontal scroll
- Getting “Failed to load resource: net::ERR_FILE_NOT_FOUND” when trying to load a background image
- CSS: background-color only inside the margin
- Stretch background image css?
- Set cellpadding and cellspacing in CSS?
- Bootstrap 4 images thumbnail classes
- Disable Scrolling on Body
- How do I set a background-color for the width of text, not the width of the entire element, using CSS?
- CSS Background Image Not Displaying
- Changing image sizes proportionally using CSS
- How to give the background-image path in CSS?
- CSS Background image not loading
- Outline radius?
- text-overflow: ellipsis not working
- How to reference nested classes with css?
- Placing border inside of div and not on its edge
- Why is there an unexplainable gap between these inline-block div elements?
- How to apply CSS to iframe?
- right align an image using CSS HTML
- CSS Background Image Not Displaying
- CSS centred header image
- How to align content of a div to the bottom
- html not linking css
- How to outline text in HTML / CSS
- How to draw a dotted line with css?
- Removing border from table cells
- How to stick text to the bottom of the page?
- How to make blinking/flashing text with CSS 3
- HTML iframe – disable scroll
- Why doesn’t height: 100% work to expand divs to the screen height?
- How can I position my div at the bottom of its container?
- Why doesn’t height: 100% work to expand divs to the screen height?
- How can I position my div at the bottom of its container?
- How to align an input tag to the center without specifying the width?
- How can I embed video for discord directly from website?
- Why would max-width not work on this?
- Basic CSS – how to overlay a DIV with semi-transparent DIV on top
- difference between width auto and width 100 percent
- Making text background transparent but not text itself
- How to show text on image when hovering?
- Square brackets in CSS
- How do I disable form fields using CSS?
- Place input box at the center of div
- Fit background image to div
- Table scroll with HTML and CSS
- Set cellpadding and cellspacing in CSS?
- Display:inline not working
- how to do a line break in Bootstrap 3.3.7
- CSS content property: is it possible to insert HTML instead of Text?
- Vertical align not working on inline-block
- How to increase height of textarea using bootstrap rows and columns
- Indent List in HTML and CSS
- Bootstrap 3 Glyphicons CDN
- Absolute position is not working
- Position absolute but relative to parent
- How do you specify table padding in CSS? ( table, not cell padding )
- Is it possible to put CSS @media rules inline?
- Make padding responsive
- Two Divs next to each other, that then stack with responsive change
- Vertically align text next to an image?
- SVG drop shadow using css3
- HTML not loading CSS file
- How can I center my ul li list in css?
- Is it possible to use css to shrink text to automatically fit the size of the div
- CSS !important not working
- How to best set a CSS3 transition to none?
- Why is vertical-align: middle not working on my span or div?
- ow to change the style of the title attribute inside an anchor tag?
- Flex align-items: center not centering items
- How can I align text directly beneath an image?
- jQuery find element by data attribute value
- How do I clear the content of a div using JavaScript?
- WordPress footer menu floating with height of footer
- Style reply form different than comment form
- Style the last element having a specific class [closed]