保持HTML图像和文本彼此相邻,文本不在图片下方

时间:2018-01-17 11:36:51

标签: html css css3

在下面的练习中,文字在照片下继续:

https://www.w3schools.com/css/tryit.asp?filename=trycss_layout_float2

有没有办法让文字保持在图片的右侧,无论有多少文字,然后用另一张图片和文字等跟着它?

1 个答案:

答案 0 :(得分:0)

float: right; 标记上使用以下css:

from selenium import webdriver
import config
import requests
from bs4 import BeautifulSoup

#choose webdriver
browser=webdriver.Firefox(executable_path="C:\\Users\\myUser\\geckodriver.exe")
browser.get("https://www.mylink.com/")

#log in
timeout = 1
login = browser.find_element_by_name("sf-login")
login.send_keys(config.USERNAME)

password = browser.find_element_by_name("sf-password")
password.send_keys(config.PASSWORD)

button_log = browser.find_element_by_xpath("/html/body/div[2]/div[1]/div/section/div/div[2]/form/p[2]/input")
button_log.click()

name = "https://www.policytracker.com/auctions/page/"
browser.get(name)

name2 = "/html/body/div[2]/div[1]/div/section/div/div[2]/div[3]/div[" + str(N) + "]/a"

#next page loaded
title1 = browser.find_element_by_xpath(name2)
title1.click()
page = browser.current_url -------> this save url from website that i want to download content (i've already logged in that page)
r = requests.get(page) ---------> i want requests to go to this page, he goes, but not included logged in proceder.... WRONG
r.content
soup = BeautifulSoup(r.content, 'lxml')
print (soup)

这将使图像保持在右侧。

在您的示例中:https://www.w3schools.com/code/tryit.asp?filename=FNJU9KRYTVUA

请注意,您应该阅读float主题中的更多内容,因为您还必须以特定方式清除浮动。请参阅https://www.w3schools.com/css/css_float.asp