Hello friend,
For any front-end developer aligning elements in a row with equal space is very common problem. This problem can be solved very easily if site is non responsive. But it will little difficult if your site is responsive.
One method to solve this problem is use some calculation with margin/padding to properly align elements with spaces in between.
Or one solution can be write huge media query for spaces in all different window widths. For example to create menu bar and keep it align horizontally for all small devices as well.
CSS3 provides one very good feature to solve such problems easily, that is- display: flex
Consider below code to display divs with text class as headers linkItem1Item2Item3Item4Item5
Apply this CSS code to display headers properly in all window widths
#container{ display:flex; justify-content: space-around; } .delimeter{ border-left:1px solid red; }Result of this code will be as: You can check this link to see the example: https://jsfiddle.net/JitendraPal/6fdLpLxd/
To work properly in all browsers use prefixed appropriately as shown below:
display: flex; display: -moz-flex; display: -ms-flex; display: -webkit-flex; justify-content: space-around; -ms-justify-content: space-around; -webkit-justify-content: space-around; -moz-justify-content: space-around;
You also like to know about:
- Do you know what happens when you hit url www.goolge.com?
- Know about Debouncing & Throttling
- AngularJS advanced trick and techniques
- Restrict input to allow only required value (jQuery plugin for input type validation)
- Spread operator or Rest parameter or Ellipsis in JavaScript
- Why call and apply two methods available in JavaScript
- Automatic Form Input Validation for complete site
- Number of ways you can create function in JavaScript +what are they called
- JavaScript Native objects
- How to Create private function in JavaScript
- functions as first class object in JavaScript
- Object Oriented concept in JavaScript
- Advanced JavaScript questions
- One good way to declare Global Variables in JavaScript
- how to align elements in a row with equal space around
- Closures in JavaScript
- AJAX call in AngularJS for cross domain service using JSONP
- Cross Site Scripting in WCF Web Service. How to use AJAX in JavaScript to Get/Consume JSON from WCF in C#
- How to add AngularJS in rails application
- Git configuration all about
- Pass XML file in stored procedure as a input parameter from C#
- XML Parser in SQL Server (T-SQL), How to parse XML in SQL
- Wish your friend with your own words and love
- Create Message in Hindi by typing in Hinglish
- Convert Multiline Text Into Single Line for HTML page