5 extremely useful tricks when making Responsive Website

1. Responsive Video

The tjkdesign website has a detailed article about this trick, you can see here . This trick makes videos embedded in web pages wide open to both sides to close to two borders.

2. Min Widht and Max Width

Max Width Container

The max-width attribute allows us to set the maximum width of the element, which prevents the element from inserting out of the required range.

Responsive Image

We can make images on the web automatically adjust the size by the maximum width of the border by the following way:

Min Width

The min-width attribute sets the smallest width of the element. In the following example, we use min-width for the input field so that the input width is too small

4b124b4606f9c5e9628b6eccd34e863f26dcdc44

3. Relative Values ​​(Relative Values)

When making Responsive website, if we know when to use relative value, it will minimize the CSS writing and display optimization of the website.

Relative Font Size

When we use em or% for font-size, line-height and margin distance will be inherited from parent element. For example, we can change the font size of the child elements by changing the font-size of parent element.

5b18afb00ee67ee3d3bd0aacbebf0a946c4d9a74

Join the Machine Learning event - Technology of the Future!
Join the Machine Learning event – Technology of the Future!

Relative Padding

The figure below shows that using a padding value in units of% instead of px is a more optimal way. The left durable element is not as balanced as the right element.

f186587c09d9aae0dcb8e790b78dc49275570019

4. Overflow: hidden

We can eliminate the effect of the float element of the previous element by using the overflow: hidden declaration for the following content:

7ac0f6608bcd2311a982174f192e3f62a2e8d9bb

5. Word-break

In case the text on the web page is too long to break the layout, we can use the word-wrap attribute to remove this.

screen-shot-2016-11-24-at-10-17-56-am

ITZone via Viblo

Share the news now