HTML 背景两种颜色

HTML background two colors

我使用此代码将背景设为蓝色:

<!DOCTYPE html>
<html>
<body style="background-color:blue;">
</body>
</html>

哪个效果不错,但我怎样才能让背景有两种不同的颜色?例如,50% 为蓝色,其余 50% 为黄色,水平分割...

使用css渐变:https://css-tricks.com/css3-gradients/

background: linear-gradient(blue, yellow);

或者如果你不想渐变,你必须设置位置:

background: linear-gradient(to right, blue 0%, blue 50%, yellow 50%, yellow 100%);