下面是代碼:如何將2個CSS矩形並排放置?默認情況下,它們出現一個低於其他
<head>
<meta http-equiv="refresh" content="01">
<title>
Slot Data
</title>
</head>
<body>
<style>
div
{
height: 100px;
width: 50px;
background-color: green;
}
</style>
<div></div>
<style>
div
{
height: 100px;
width: 50px;
background-color: green;
}
</style>
<div></div>
</body>
他們似乎只有一個在另一個之下。
此外,我需要一種方式來改變顏色「綠色」爲「紅色」的條件寫入蟒蛇。爲此,該片段是:
if count1 >= 0.65 * 122*85:
print "car0 absent"
cv2.rectangle(dst1,(8,8),(340,488),(0,255,0),2) #green
cv2.putText(dst1,'slot empty',(12,450), font, 1,(255,255,255),1,cv2.LINE_AA)
f = open('test.html','r')
filedata = f.read()
f.close()
newdata = filedata.replace("red","green")
f = open('test.html','w')
f.write(newdata)
f.close()
else:
print "car0 present"
cv2.rectangle(dst1,(8,8),(340,488),(0,0,255),2) #red
cv2.putText(dst1,'slot occupied',(12,450), font, 1,(255,255,255),1,cv2.LINE_AA)
f = open('test.html','r')
filedata = f.read()
f.close()
newdata = filedata.replace("green","red")
f = open('test.html','w')
f.write(newdata)
f.close()
和我有另一個car1相同的代碼。 我如何解決兩個矩形的不同?替換機制將取代我不想要的兩個CSS矩形的顏色。
任何幫助表示讚賞。
使用'float:left'使它們並排顯示 –