You can easily do this with flex-box features.
try this:
display: flex;
align-items: center;
justify-content: center;
More Related Contents:
- Trouble with image
- 100% height background starting at 50% horizontally
- Is it possible to set the equivalent of a src attribute of an img tag in CSS?
- flex-grow not sizing flex items as expected
- How to make blinking/flashing text with CSS 3
- AngularJS ngClass conditional
- Responsive image map
- How to make a vertical line in HTML
- How to display an unordered list in two columns?
- Difference in applying CSS to html, body, and the universal selector *?
- css background color with floating elements
- Transform: translate(-50%, -50%)
- How to create a curve between two gradient using CSS?
- Line break (like ) using only css
- Turn off Chrome/Safari spell checking by HTML/css [duplicate]
- How to get a background image to print using css?
- How to set an image’s width and height without stretching it?
- Make flex items overlap
- HTML class attribute with spaces, it is a W3C valid class?
- Aligning elements left and center with flexbox
- How to set placeholder value using CSS?
- Changing the highlight color when selecting text in an HTML text input
- Title with bottom border smaller than width
- How to run the CSS3 animation to the end if the selector is not matching anymore?
- How to add button inside an input [closed]
- Unwanted border-radius corners around images in Brave/Chrome browser
- Progress Bar with HTML and CSS
- scrollable?
- Why aren’t my bootstrap 4 columns the same height?
- IE7 CSS Scrolling Div Bug