如何在HTML程序中实现背景色?

问题描述 投票:0回答:1

我目前正在学习编码课程,并且正在学习如何使用Python(Python 3)进行编码,并且正在做一个涉及制作自己的网页的作业。在作业说明中,它说我必须实现背景颜色或背景图像,我发现一些代码完全可以做到这一点,但是当我在课程的评分员中运行它时,它却说我错过了。我目前正在Repl.it上编码。谁能帮助我找出我做错了什么?有没有其他方法可以实现背景色?

这里是分配说明:

enter image description here

这是我的代码:

<!DOCTYPE html>
<html>
<head>
<title>All About Sharks</title>
</head>
<body bgcolor="#86A2FF"> 

<h1 align = "center" style ="color:White;font-family:Times;font-size:50px">All About Sharks</h1>

<a href="https://seethewild.org/shark-threats/">Endangered Sharks Page</a>
<a href="mailto:[email protected]?Subject=Hello%20again" target="_top">Send Mail Here</a>
<hr>


<h2 style ="color:White;font-size:20px;font-family:Arial"> What Are Sharks?</h2>

<p style ="color:Black;font-family:Times"><b><i> Sharks are a type of long-bodied marine fish with a cartilaginous skeleton (skeleton made entirely of cartilage), a large dorsal fin, and toothlike scales (also called placoid). Most sharks are predatory, although the largest kinds feed on plankton, and some can grow to larger sizes.</b></i></p>

<img src="https://images.freeimages.com/images/large-previews/e3c/shark-1367473.jpg" width="250" height="200">
<img src="https://images.freeimages.com/images/large-previews/42c/shark-1384982.jpg" width="250" height="200" class="center">

<hr>

<h3 style ="color:White;font-family:Arial;font-size:20px"> Where Are Sharks Found?</h3>

 <p style ="color:Black;font-family:Times"><b><i>Sharks are found in all five of the Earth's oceans: the Atlantic, Pacific, Indian, Arctic, and Southern. Although they are commonly found in oceans, sharks can also be found in freshawater lakes and some rivers.</b></i></p>
 
<img src="https://images.freeimages.com/images/large-previews/749/flatnose-shark-1250133.jpg" width="250" height="200">
<img src="https://images.freeimages.com/images/large-previews/201/shark-1520496.jpg" width="250" height="200" class="center">

<hr>

<h4 style ="color:White;font-family:Arial;font-size:20px"> What Do Sharks Eat?</h4>

<p style ="color:Black;font-family:Times"><b><i>Sharks eat a wide variety of marine life ranging from smaller organisms like snails, sea urchins, crabs, and fish to larger organisms like stingrays, other sharks, seals, and birds.

<img src="https://images.freeimages.com/images/large-previews/cd1/blue-crab-1539361.jpg" width="250" height="200">
<img src="https://images.freeimages.com/images/large-previews/50f/stingray-1520490.jpg" width="250" height="200" class="center">

<hr>

<h5 style ="color:White;font-family:Arial;font-size:20px"> What Is The Purpose Of This Page?</h5>

<p style ="color:Black;font-family:Times"><b><i>The entire purpose of this page is to bring attention to educate about endangered marine animals, particularly sharks. According to IUCN analysts, among all 470 species of sharks, 2.4 percent are critically endangered, 3.2 percent are endangered, 10.3 percent are vulnerable, and 14.4 percent are near threatened. Sharks are considered apex predators (meaning that they sit at the very top of the food chain) and their lives are being threatened everyday by commercial shark finning (usually for medicine or shark fin soup), overfishing, fisheries bycatch, and habitat and prey loss.

<hr>


</body>
</html>

**说的行

<body bgcolor="#86A2FF">

是我的背景色代码。**

注意:我的图片在“鲨鱼吃什么”标题下可能看起来有些怪异。

html url
1个回答
0
投票

您可以使用CSS内联样式轻松完成此操作:

<body style="background-color: red">
...
</body>
© www.soinside.com 2019 - 2024. All rights reserved.