If the div has an fixed width and height use:
(if width=120px and height=80px)
position: fixed;
top: 50%;
left: 50%;
margin-left: -60px; /* negative half of the width */
margin-top: -40px; /* negative half of the height */
More Related Contents:
- Why is percentage height not working on my div? [duplicate]
- CSS negation pseudo-class :not() for parent/ancestor elements
- Flexbox: 4 items per row
- IE8 issue with Twitter Bootstrap 3
- Making a div vertically scrollable using CSS
- Matching the first/nth element of a certain type in the entire document
- Elongated hexagon shaped button using only one element
- Align image in center and middle within div
- CSS :first-letter not working
- CSS absolute position won’t work with margin-left:auto margin-right: auto
- Is it possible to display an .html document , or .html fragment at CSS content?
- What are the priorities among CSS selectors
- How to add button inside input [closed]
- CSS: How can I set image size relative to parent height?
- How to make images stay within the rows of a css grid container?
- CSS – Sticky footer [duplicate]
- what does -webkit-transform: translate3d(0,0,0); exactly do? Apply to body?
- How to center an iframe horizontally?
- How to Make A Chevron Arrow Using CSS?
- Change the column order in a css grid
- How to center buttons in Twitter Bootstrap 3?
- :before && :after pseudo elements not showing Firefox
- @font-face not working with specific version of Internet Explorer 11
- Pin a flex item to the bottom of the container
- Border around specific rows in a table?
- Making a div that covers the entire page
- Word wrap a link so it doesn’t overflow its parent div width [duplicate]
- How to calc() the number of rows in a grid template?
- Is it possible to set a src attribute of an img tag in CSS?
- How to fill 100% of remaining height?