How to use CSS to push the footer to the bottom of the browser window. New Footer tags html design
This tag can be used, like previous tags, several times on a page. You probably already guessed from the name that it is the footer of the page. It can contain counters, text about copyright on the site, contact information, etc. It is also possible to insert a navigation bar () into the footer of the page. No one forbids inserting new elements such as aside and section, but I still wouldn’t do it if I were you.
And
Site header
Post #1
Here we will write the text of the first post.
Post #2
Here we will write the text of the second post.
The result should be the following:
From this example it follows that each individual article or post can have its own elements
Well, now you have become acquainted with the basic structural elements of HTML5, and in the next lessons we will look at even more new elements, various forms that were not in other HTML specifications!
We are starting the fifth lesson on editing templates in CMS Joomla 3, this time we will talk about the footer for the site. Let's look at possible footer design options and some approaches to creating it.
What is a footer
The footer or footer of a site is the lowest part of it, which usually contains information about the site, copyright, etc. Standard version in template Protostar, the footer does not contain any meaningful information:
The standard content of the footer is the current year, the name of the site and the “Back to Top” link leading to the top of the page. To be honest, this footer option is completely useless to visitors to our site, besides, the “Back to Top” link is absolutely unnecessary in our case, we have already made a beautiful button for these purposes.
Therefore, to begin with, I suggest getting rid of the standard footer content. Open the file index.php standard Protostar template and look for the code that is responsible for displaying the footer. The code between lines 205 and 219 is responsible for displaying the footer, which looks like this (depending on the version of Joomla and the changes made to the index file, the lines of code may differ):
Now let’s remove the extra code from lines 210 to 217; as a result, the code for the footer will be like this:
Essentially, we removed everything that was possible, leaving only the ability to display modules in the footer; this line is responsible for this:
We save the index file, go to the site and refresh the page. The footer content disappeared, which is what we wanted. Now you can add new information to the footer at your discretion, but before adding it, it’s worth answering the question - what can be in the footer of the site?
What information to display in the site footer
In order to make the footer effective, it must contain information that may be of interest to site visitors. Depending on the focus of the site, this information may vary. Here is a small example of the same information that may be contained in the footer:
- Extra menu- this menu can duplicate an existing one, or be unique. Duplicating the menu in the footer is useful when your site is often visited from mobile devices; the visitor, having scrolled to the very bottom of the page, can take advantage of additional site navigation.
- Contact Information- for selling sites, or for sites that provide various services, the presence of contact information is simply necessary, and the footer is the place for it.
- Social media buttons- in the modern world, social networks are everything for many people, so such information will never be superfluous.
- Various links- for example, links to a site map, news feeds, etc.
- Widgets- you can display in the footer information reflecting activity on the site, traffic counters, recent comments, etc.
- Advertising- there comes a time when you want to get from the site not only its presence, but also profit, in this case the footer may not be a bad container for advertising.
Don’t try to cram all of the above into the footer of your site; an overabundance of information, like its absence, will also not lead to anything good.
On the other hand, it doesn’t matter what information will be contained in the footer of your site, the main thing is that it fits into the overall design and is beautifully designed.
Creating a footer for the site
Now let's discard the theory and proceed directly to creating the footer. There can be several ways to form a footer:
- Auto- involves the use of various modules to display certain information
- Manual- modules are not used, all changes are made manually using template file editing tools
- Mixed- in this case, both of the above options are used together
Each of the methods is good in its own way, for example, at the initial stage, using modules will greatly simplify the task, and the method when modules are not used will speed up page loading. In any case, the choice is yours.
In order to consider all possible options, I will opt for the third option. This way, you will have a general idea of what is being edited and how.
As an example, I decided to divide the footer into three vertical parts, links to certain pages of the site will be displayed on the left, some kind of logo will be in the center, and small text will be displayed on the right. Modules will be responsible for displaying the left and right parts of the footer, and we will write the logo manually in the index file.
First, let's create new positions for modules in the footer (we talked about how to do this in the lesson on setting up and editing templates) in the amount of two pieces. Since they will be located on the left and right sides of the footer, they have a corresponding name - footer-left And footer-right. We declare them in the file templateDetails.xml.
Now we make changes to the template index file, my code turned out like this:
And for clarity, a screenshot:
It’s clear how the modules are displayed, but I’d like to dwell on the logo in more detail. The code responsible for displaying the logo is:
baseurl. "templates/". $this->template . "/images/joom4all.png"?>" />
At first glance, it looks like an ordinary HTML tag for an image, but instead of the usual file path, PHP code is written. This code may seem complicated and incomprehensible at first glance, but in fact, if you look at it, it becomes clear that there is nothing complicated in it:
- - start of php code
- echo- responsible for outputting a string
- $this->baseurl- this line returns the site name
- templates/- here we indicate that the image is stored in the templates folder
- $this->template- returns the name of the current template
- /images/joom4all.png- path to the image inside the template root folder and name of the file with the image
- ?> - end of php code
As a result of using this php code, we get the relative path to the image file. In other words, no matter what name the site has or what template is used, the image will be taken from the images folder of the selected template.
We save the file index.php, now we can close it, we will no longer need it.
Now let's create several modules, which we will display in the newly created new positions. The first module will display a menu in the footer, and the second will display small text.
At the next stage, we create modules - for a menu with the “Menu” type and for text with the “HTML code” type (how to create a module). We select the newly created module positions as positions for them:
To distinguish our footer menu from the rest of the menu on the site, in the menu module settings we add the “_footer” class suffix to it:
In order not to explain what kind of module with the “HTML code” type is, I will show the principle of its operation in the screenshot:
I filled this module with certain text that will be displayed in the footer, in addition to the regular text, I wrote a small php code that displays the current year:
We save the modules and go to the site to check the result and this is what I got:
Although the result is there, it is not very impressive. Now we need to more adequately style the footer elements using CSS.
First, let's create new footer blocks:
Foot-left, .foot-center(float: left;) /*footer block alignment*/ .foot-left (width: 20%;) /*left block width*/ .foot-center (margin-left: -6px ;) /*central block indent*/ .foot-right ( /*right block*/ float: none; height: 60px; )
The next candidate for styling is the menu, to which I applied the following styles:
Ul.nav.menu_footer (margin: 0;) /*zero margins for the menu*/ ul.nav.menu_footer li ( /*design of menu text*/ font-family: "Lobster", cursive; font-size: 16px; line -height: 18px; ) ul.nav.menu_footer li.item-179 a ( /*Sitemap menu item*/ margin-left: 15px; color: #fc8f30; ) ul.nav.menu_footer li.item-180 a ( /*Menu item About the site*/ color: #5aa426; border-top: 3px solid #5aa426; ) ul.nav.menu_footer li.item-181 a ( /*Menu item Contacts*/ margin-left: 45px; border- bottom: 3px solid #0f70ad; color: #0f70ad; )
And finally, we separate the footer from the main part of the content:
Footer.footer hr (border-top: 3px solid #fc8f30;) /*separate the footer from the main content*/
Save the style file, go to the site and look at the result:
So we created a footer for our site that looks much more fun than the standard one. This concludes this lesson, and in the next lesson we will check possible errors in adaptive design and correct some shortcomings. In addition, I advise you to read the article on how to quickly create a Joomla 3 template and in particular a footer from scratch using Bootstrap.
Often when installing buttons, banners, etc. there is a need inserting html, css and javascript codes in the body of the body and head tags. Failure to perform this operation correctly manually can damage the site and even completely disrupt its functionality.
A wonderful plugin has been created to automate this process, go to the settings in the admin panel and work with pleasure. It is easy to use and has the following features:
To enlarge the picture, click on it. To zoom out, click again.
1. Page Head and Footer. Adding code to the main page of the site.
Code to be added on HEAD section of the home (code that must be inserted into the header of the home (main) page). Allows you to insert meta tags, codes for advertising banners, buttons, etc. in the body of the tag
. More often this is an invisible part of the code for lack of visual display on the site. The result of the visible part of the code will appear above the header on the main page.Code to be added on HEAD section of every page (code that must be inserted into the header of each page). Adding Code to the Tag Body
to the HEAD section. The result of the visible part of the code will appear above the header on all pages, including the main one.Code to be added before the end of the page (code that must be inserted at the end (footer) of the page). Adding code to the footer on all pages before the closing tag