UG-04, Westfeild Complex, Ghod Dod Road

website development – Best web designing company

website development

Creating a sticky footer is one of the most common website development tasks you can easily solve with flexbox. Without a sticky footer, if you don’t have enough content on the page, the footer “jumps” up to the middle of the screen, which can completely ruin the user experience. Before flexbox, developers used negative margins to force the footer down to the bottom of the page. Luckily, we don’t need such a hack anymore!

HOW tO CREATE A STICKY FOOTER WITH FLEXBOX

Creating a sticky footer is one of the most common web development tasks you can easily solve with flexbox. Without a sticky footer, if you don’t have enough content on the page, the footer “jumps” up to the middle of the screen, which can completely ruin the user experience. Before flexbox, developers used negative margins to force the footer down to the bottom of the page. Luckily, we don’t need such a hack anymore!website development

In this article, we will show you an easy technique that allows you to create a sticky footer with flexbox. It takes just a few lines of code and a couple of minutes to implement it.website development

1. START WITH THE HTML with website development

In our HTML file, we create a heading, two paragraphs with some lorem ipsum text, and a footer so that we can easily test the sticky footer functionality. Open your code editor, create a new folder (or project, depending on the code editor) and an empty index.html file inside of it. Then, add the following code:

website developemnt

2. ADD SOME BASIC STYLES IN CSS

To make our demo work, let’s start our CSS file with some simple resets and basic styles. However, note that these basic styles are just recommendations and you can use any other styles instead of them — they are not required for the sticky footer functionality.

Note : Read our blog PM MODI LAUNCHES ‘AATMANIRBHAR BHARAT APP INNOVATION CHALLENGE

Create a style.css file in the same folder where your index.html file is found. Then, add the following code:

3. STYLE THE FOOTER

Now, we add some CSS styles to the footer as well, however, note that this is still not the sticky footer functionality. You can change these basic footer styles to any other design you like.

Add the following code to your stlye.css file, below the previous CSS block:

4. MAKE THE FOOTER STICKY WITH FLEXBOX

Now let’s see the CSS code that we need to use to create a sticky footer with flexbox. In fact, it is just five CSS rules. You can use this technique with any kind of footer in any browser that supports flexbox. Flexbox support is pretty good by now; currently 97.93% of all browsers in use support it globally, and it’ll get even better with time.

Here is the code you need to add to your style.css file. Ideally, you should add this snippet before the general footer styles (added in the previous step):

 

Read out article THE INTERNET “JUST WORKS”: THE EARN IT ACT THREATENS THAT AND MORE

Leave a comment