简体   繁体   English

我如何获得此视图的 html 和样式?

[英]how do i get the html and style of this view?

i'm a beginner in web programming, and i need to create a web site for a school project.我是网络编程的初学者,我需要为学校项目创建一个网站。

In my website i want to have this view:在我的网站中,我想有这样的看法:

我需要的视图

that i saw on a website .我在一个网站上看到的。

how do i get the html of that?我怎么得到那个的html?

Use your browser's tools!使用浏览器的工具!

First, as you mentioned "views" – "views" don't exist in HTML.首先,正如您提到的“视图”——HTML 中不存在“视图”。 But there are tags.但是有标签。 Common tags are <a href="...">...</a> , <strong>bold text</strong> , <div>...</div> , ... What you want is to grab a tag with several child tags.常见的标签是<a href="...">...</a><strong>bold text</strong><div>...</div> 、 ... 你想要的是抓取带有多个子标签的标签。

In Firefox, there's a tool called Page inspector .在 Firefox 中,有一个名为Page inspector的工具。 It'll let you inspect the site's source code interactively (eg you hover over a tag and it'll be highlighted).它将让您以交互方式检查站点的源代码(例如,您将鼠标悬停在一个标签上,它将被突出显示)。 With that, you can easily find the needed HTML tags.有了它,您可以轻松找到所需的 HTML 标签。 But you also need the CSS styles for each tag.但是您还需要每个标签的 CSS 样式。 If you click on a tag, the CSS styles are shown on the right.如果单击标签,CSS 样式将显示在右侧。 You have to copy them to your stylesheet and maybe you'll have to modify them to match your different HTML structure.您必须将它们复制到您的样式表中,也许您必须修改它们以匹配您不同的 HTML 结构。

There's something similar in Chrome, too. Chrome 中也有类似的东西。

But please note that it's not very nice to simply copy-paste this code without modifying it.但请注意,简单地复制粘贴此代码而不修改它并不是很好。 It's a good idea to discover how you can do something like this, but I strongly recommend to change it, to have something own!发现如何做这样的事情是个好主意,但我强烈建议改变它,拥有自己的东西!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM