code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.div1{
height: 100px;
width: 100px;
border-left: 100px yellow solid;
border-bottom: 100px black solid;
border-right: 100px peru solid;
border-top: 100px goldenrod solid;
}
</style>
</head>
<body>
<div class="div1"></div>
</body>
</html>
原理:
也就是說(shuō)每一個(gè)border是以一個(gè)等腰梯形來(lái)渲染的,并且上底為內(nèi)容的寬度,下底設(shè)定為內(nèi)容寬度加上border設(shè)定的寬度的兩倍姜挺,而不是一個(gè)長(zhǎng)方形兼贸,如果我們將width和height全部變?yōu)?段直,那么就可以得到:
將其余的地方變成和背景色一樣的話,就可以變成三角形溶诞。
for i in PollingItemImages.objects.filter(is_avatar=True):
i.does_exist=True
i.save
for i in PollingItemImages.objects.filter(does_exist=True):
i.does_exist=False
i.save
len(PollingItemImages.objects.filter(does_exist=True))
for i in PollingItemImages.objects.filter(polling_item_id='c9563da441e2456e88506e54abb91111'):
if i.image == 'polling/item/img/40ef448d2643498087016a0da8dca4dc.png':
i.is_avatar=True
else:
i.is_avatar=False
i.save()
# item = PollingItemImages.objects.filter(polling_item_id=i.id)
count = 0
for i in PollingItem.objects.filter(is_successful=True):
item = PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True)
temp = len(item)
if temp>1:
print(len(item))
item.update(does_exist=False)
temp2=item[temp-1]
temp2.does_exist=True
temp2.save()
count=count+1
print(temp,count)
count = 0
for i in PollingItem.objects.filter(is_successful=True):
temp = len(PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True,))
count=count+1
print(temp,count)
count = 0
for i in PollingItem.objects.filter(is_successful=True):
item1 = PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True,does_exist=True)
item2 = PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True)
temp = len(item1)
if temp == 0 :
count=count+1
print(temp,count)
一些pythonshell里面操作的代碼