CSS means Cascading Style Sheets. It is a language which is used for the making the presentation of Web pages, including colors, layout and fonts and that too on different devices. It helps in saving your hard work and time and enables you to get the layout of multiple pages on a single screen. It is sometimes misunderstood that CSS depends upon HTML that is totally wrong. It may be due to the reason that the <div> in the elements are often created by using the HTML.
CSS is actually a style sheet language which is independent of HTML and it can be used with XML- based markup languages. While setting margins in case of CSS the one thing that we should keep in mind is that the values of top and bottom margins should be set to 0 while the values of left and right margin should be set to ‘auto’.
Centralizing images through CSS
Centralizing images through CSS in is not a very difficult function. It can be easily done by using a few commands. While centralizing images most of the browsers use text alignment methods which is not a long reliable concept. You could also be enabled to centralize the images by without using this concept. This can be easily done with the help of explicitly using block level elements.
Now, the first question that strikes in our mind is that what exactly are ‘Blocks’. Blocks are actually elements that are present in our page with predefined widths. These blocks can be easily created by using <div> elements of HTML. You can easily centralize your images by using any other blocks in the following way:
When you use this command; you should also use the HTML code provided below to centralize the desired image.
<IMG class=”displayed” src=”…” alt=”…”>
The one thing that you should keep in mind is that while adding CSS commands to the various HTML codes with breaks you can’t use CSS inline functions. You can do it by just adding the following command:
<div style=”text-align: center;”>
Sometimes we have some images with fixed widths and heights in such type of images. These images need to have different codes for centralizing images. We can use the command given below for centralizing the images:
If you have questions please comment below.