Inline CSS for Setting Page Background: Simplifying HTML Code

  • Context: HTML/CSS 
  • Thread starter Thread starter biferi
  • Start date Start date
  • Tags Tags
    Css
Click For Summary
SUMMARY

The discussion focuses on the transition from using HTML attributes to inline CSS for setting page backgrounds. Users are encouraged to replace the traditional tag attributes like BGCOLOR and BACKGROUND with the CSS property "background-color" for better practice. The correct syntax for inline CSS is demonstrated as . This method simplifies HTML code and enhances styling capabilities.

PREREQUISITES
  • Understanding of HTML structure and syntax
  • Familiarity with CSS properties and their usage
  • Knowledge of inline CSS implementation
  • Basic color codes in CSS (hexadecimal and named colors)
NEXT STEPS
  • Learn about CSS background properties, including background-image and background-size
  • Explore CSS best practices for responsive design
  • Study the differences between inline, internal, and external CSS
  • Investigate browser compatibility for CSS properties
USEFUL FOR

Web developers, front-end designers, and anyone looking to modernize their HTML coding practices by utilizing CSS for styling.

biferi
Messages
191
Reaction score
0
When I use HTML I set my Page Tag like this

<BODY BGCOLOR="#000000" BACKGROUND="food.jpg" text="#FFFFFF" link="#FFFF00" vlink="#FFFF00" alink="#FFFF00">

But now I am using Inline CSS so can I do this to set my page background?

<body style="background:black;">
 
Technology news on Phys.org
biferi said:
<body style="background:black;">

use background-color:#000;
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
10
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K