Skip to main content

How to Set a Background Image in HTML


If you want to add a background image instead of a plain color there are some considerations you should make before doing so:
  • Is the background image discrete enough to not take away the focus from what's written on it?


  • Will the background image work with the text colors and link colors I set up for the page?


  • Will the background image work with the other images I want to put on the page?


  • How long will the page take to load my background
    image? Is it simply too big?


  • Will the background image work when it is copied to fill the entire page? In all screen resolutions?

After answering these questions, if you still want to add the background image you will need to specify in the <body> tag which image should be used for the background.

<body background="drkrainbow.gif"> 


Note:
If the image you're using is smaller than the screen, the image will be replicated until it fills the entire screen.


If, say you wanted a striped background for your page, you wouldn't have to make a huge image for it. Basically you could just make an image that is two pixels high and one pixel wide. When inserted on the page the two dots will be copied to fill the page - thus making what looks like a full screen striped image.




When you choose to use a background image for the page it is always a good idea to specify a background color as well.

<body background="drkrainbow.gif" bgcolor="#333333"


The reason is that until the background image is loaded, the background color will be shown.

If there is too much difference between the background color and the background image, it will look disturbing once the browser shifts from the background color to the image.

Therefore it is a good idea to specify a background color that matches the colors of the image as close as possible.




You may have noticed that background images scroll with the page when you use the scroll bar.The background image will scroll when the user scrolls down the page, unless you have set it to be fixed:

<body background="drkrainbow.gif" bgproperties="fixed"



By adding the bgproperties="fixed" you force the browser to let the background be fixed even if the user is scrolling down the page. 

Note: Fixed backgrounds are only supported by MSIE and do not work in Netscape browsers - instead they simply act as normal backgrounds.





As mentioned earlier in this section a limited use of colors can add more power to the few colors that are used.

The most important tool for adding colors to certain areas of the page rather than the entire background is tables.



                www.bitdefenderhelp.com

                www.printersupport.world

Comments

Popular posts from this blog

Shocking Truth: Heart Attacks are Happening at an Alarming Rate in Young Adults

  Introduction: Heart attacks have long been associated with the elderly population, but recent studies have shown that young adults are also at risk. The incidence of heart attacks in young adults is rising at an alarming rate, and it's a cause for concern. In this blog post, we will discuss the reasons behind heart attacks happening at an early age, the risk factors, and how to prevent them. Why are heart attacks happening at an early age? The reasons for heart attacks in young adults are multifactorial. Lifestyle choices such as an unhealthy diet, lack of exercise, and stress are the primary culprits. Poor lifestyle choices, along with genetic factors, can increase the risk of developing heart disease. Moreover, an increase in obesity and sedentary lifestyles, especially among the younger population, contributes to the rising incidence of heart attacks. Risk factors for heart attacks in young adults: The risk factors for heart attacks in young adults are similar to those in the ...

Unlock Your Savings Potential: 8 Proven Strategies for Building Wealth

Maximize your savings and build wealth with these 8 proven strategies. Learn how to save money effectively and achieve financial freedom faster. Introduction: Are you looking to boost your savings and achieve financial freedom faster? Saving money is the key to building wealth and securing your financial future. In this blog post, we'll share 8 proven strategies to help you save more effectively and unlock your savings potential. Start your journey to financial success today! Set Clear Savings Goals Setting specific, measurable, and achievable savings goals is the first step towards financial success. Whether you're saving for an emergency fund, a down payment on a home, or retirement, having clear goals will help you stay motivated and focused on your savings journey. Create a Budget and Stick to It A well-structured budget is essential for effective saving. Allocate a portion of your monthly income to savings and prioritize this in your budget. Use budgeting tools and apps li...

Essential Blog Writing Tips for WordPress Beginners

Essential Blog Writing Tips for WordPress Beginners Good blog writing skills contribute a lot to promote a website. In order to build a large audience base and tremendous popularity with lots of new visitors each day, you need to pay more attention to content creation to catch readers’ attention. Without quality content, whatever you have done in your blog will be in vain. Thus, improving the skill is a top task for beginners. However, they may be confused about how to write, what to write and how to make their blog eye-catching. Considering this, we have comprehensively concluded following important blog writing tips for our readers. Be Enthusiastic about Reading Before being a good writer, you need to be a good reader at first. In fact, many successful writers have a good habit on reading. When reading some articles selected from other authors, you need to learn how they can write such fascinating posts. Besides, the best way to get the skills from others is taking notes...