HTML:-
<nav role='navigation'>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav> CSS:-
* {
box-sizing:border-box;
}
ul {
width:700px;
margin:10px auto;
text-align:center;
}
li {
list-style:none;
float:left;
border:1px solid red;
padding:10px 0;
}
a {
background:lightgrey;
display:block;
} JavaScript:-
(function( $ ){
$.fn.autowidth = function() {
return this.each(function() {
$('li', this).css({'width' : (100 / $('li', this).length) + '%'})
});
};
})( jQuery );
$(document).ready(function(){
$('nav > ul').autowidth();
});
To collect a group of elements, we pass the selector to the jQuery function using…
jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is…
Prevent users typing special characters in text box, textarea, etc. [crayon-693568bf3afa6747303964/] ^[a-zA-Z]+$ Alphabets ^[a-zA-Z\s]+$ Alphabets…
Any interactive web site has form input - a place where the users input different…
[crayon-693568bf3b4ab734614826/]