Ashburn, June 27, 2017

Awesome CSS Tricks

Here are a bunch of incredibly useful CSS tricks that will help you design great websites. You might already know some or all of these techniques, but this can be your handy resource to handy CSS tricks that you should know.

1. Align Elements Vertically

Nowadays CSS3 makes vertical alignment really simple!

Just add to the parent <div> this css:

display:flex;
align-items:center;
justify-content:center;

2. Align Elements Vertically

Add to the parent <div> this css:

display: flex;

3. Fit background image to div

You can achieve this with the background-size property, which is now supported by most browsers.

To scale the background image to fit inside the div:

background-size: contain;

To scale the background image to cover the whole div:

background-size: cover;
About Karlos Maldonado 36 Articles
Computer Sciences Engineer graduated from Florida Atlantic University (FAU) in Boca Raton, Florida. Has gotten great experience in the IT and Web Development industry working for companies such as SIRIUS XM RADIO, 4MEDIA as well as collaborating with local companies.

Be the first to comment

Leave a Reply

Your email address will not be published.