HTML uses tags, which are characters that sit inside angled brackets. They act like containers and tell you something about the information that lies between them.
Tags are often referred to as elements.
Tags usually come in pairs. The opening tag denotes the start of a piece of content; the closing tag denotes the end.
Opening tags can carry attributes, which tell us more about the content of that element.
Attributes require a name and a value.
To learn HTML you need to know what tags are available for you to use, what they do, and where they can go.
Chapter 2: Text
HTML elements are used to describe the structure of the page (e.g. headings, subheadings, paragraphs).
They also provide semantic information (e.g. where emphasis should be placed, the definition of any acronyms used, when given text is a quotation).
Chapter 3: Lists
There are three types of HTML lists: ordered, unordered, and definition.
Ordered lists use numbers.
Unordered lists use bullets.
Definition lists are used to define terminology.
Lists can be nested inside one another.
Chapter 4: Links
Links are created using the <a> element.
The <a> element uses the href attribute to indicate the page you are linking to.
If you are linking to a page with your own site, it is best to use relative links rather than qualified URLs.
You can create links to open email programs with an email address in the “to” field.
You can use the id attribute to target elements within a page that can be linked to.
Chapter 5: Images
The <img> element is used to add images to a web page.
You must always specify and an src attribute to indicate the source of an image and an alt attribute to describe the content of an image.
You should save images at the size you will be using them on the web page and in the appropriate format.
Photographs are best saved as JPEGs; illustrations or logos that use flat colors are better saved as PNGs.
Chapter 6: Tables
The <table> element is used to add tables to a web page.
A table is drawn out row by row. Each row is created with the <tr> element.
Inside each row there are a number of cells represented by the <td> element (or <th> if it is a header).
You can make cells of a table span more than one row or column using the rowspan and colspan attributes.
For long tables you can split the table into a <thead>, <tbody>, and <tfoot>.
Chapter 7: Forms
Whenever you want to collect information from visitors you will need a form, which lives inside a <form> element.
Information from a form is sent in name/value pairs.
Each form control is given a name, and the text the user types in or the values of the options they select are sent to the server.
HTML5 introduces new form elements which make it easier for visitors to fill in forms.
Chapter 8: Extra Markup
DOCTYPES tell browsers which version of HTML you are using.
You can add comments to your code between the <! -- and --> markers.
The id and class attributes allow you to identify particular elements.
The <div> and <span> elements allow you to group block-level and inline elements together.
<iframes> cut windows into your web pages through which other pages can be displayed.
The <meta> tag allows you to supply all kinds of information about your web pages.
Flash allows you to add animations, video and audio to the web.
Flash is not supported on iPhone and iPad.
HTML5 introduces new <video> and <audio> elements for adding video and audio to web pages, but these are only supported in the latest browsers.
Browsers that support the HTML5 elements do not all support the same video and audio formats, so you need to supply your files in different formats to ensure that everyone can see/hear them.
Chapter 10: Introducing CSS
CSS treats each HTML element as if it appears inside its own box and uses rules to indicate how that element should look.
Rules are made up of selectors (that specify the elements the rule applies to) and declarations (that indicate what these elements should look like).
Different types of selectors allow you to target your rules at different elements.
Declarations are made up of two parts: the properties of the element that you want to change, and the values of those properties. For example, the font-family property sets the choice of font, and the value arial specifies Arial as the preferred typeface.
CSS rules usually appear in a separate document, although they may appear within an HTML page.
Chapter 11: Color
Color not only brings your site to life, but also helps convey the mood and evokes reactions.
There are three ways to specify colors in CSS: RGB values, hex values, and color names.
Color pickers can help you find the color you want.
It is important to ensure that there is enough contrast between any text and the background color (otherwise people will not be able to read your content).
CSS3 has introduced an extra value for RGB colors to indicate opacity. It is known as RGBA.
CSS3 also allows you to specify colors as HSL valued, with an optional opacity value. It is known as HSLA.
Chapter 12: Text
There are properties to control the choice of font, size, weight, style, and spacing.
There is a limited choice of fonts that you can assume most people will have installed.
If you want to use a wider range of typefaces there are several options, but you need to have the right license to use them.
You can control the space between lines of text, individual letters, and words. Text can also be aligned to the left, right, center, or justified. It can also be indented.
You can use pseudo-classes to change the style of an element when a user hovers over or clicks on text, or when they have visited a link.
Chapter 13: Boxes
CSS treats each HTML element as if it has its own box.
You can use CSS to control the dimensions of a box.
You can also control the borders, margins and padding for each box with CSS.
It is possible to hide elements using the display and visibility properties.
Block-level boxes can be made into inline boxes, and inline boxes made into block-level boxes.
Legibility can be improved by controlling the width of boxes containing text and the leading.
CSS3 has introduced the ability to create image borders and rounded borders.
Chapter 14: Lists, Tables & Forms
In addition to the CSS properties covered in other chapters which work with the contents of all elements, there are several others that are specifically used to control the appearance of lists, tables, and forms.
List markers can be given different appearances using the list-style-type and list-style-image properties.
Table cells can have different borders and spacing in different browsers, but there are properties you can use to control them and make them more consistent.
Forms are easier to use if the form controls are vertically aligned using CSS.
Forms benefit form styles that make them feel more interactive.
Chapter 15: Layout
<div> elements are often used as containing elements to group together sections of a page.
Browsers display pages in normal flow unless you specify relative, absolute, or fixed positioning.
The float property moves content to the left or right of the page and can be used to create multi-column layouts. (Floated items requires a defined width.)
Pages can be fixed width or liquid (stretchy) layouts.
Designers keep pages within 960 - 1000 pixels wide, and indicate what the site is about within the top 600 pixels (to demonstrate its relevance without scrolling).
Grids help create professional and flexible designs.
CSS Frameworks provide rules for common tasks.
You can include multiple CSS files in one page.
Chapter 16: Images
You can specify the dimensions of images using CSS. This is very helpful when you use the same sized images on several pages of your site.
Images can be aligned both horizontally and vertically using CSS.
You can use a background image behind the box created by any element on a page.
Background images can appear just once or be repeated across the background of the box.
You can create image rollover effects by moving the background position of an image.
To reduce the number of images you browser has to load, you can create image sprites.
Chapter 17: HTML5 Layout
The new HTML5 elements indicate the purpose of different parts of a web page and help to describe its structure.
The new elements provide clearer code (compared with using multiple <div> elements).
Older browsers that do not understand HTML5 elements need to be told which elements are block-level elements.
To make HTML5 elements work in Internet Explorer 8 (and older versions of IE), extra JavaScript is needed, which is available free from Google.
Chapter 18: Process & Design
It’s important to understand who your target audience is, why they would come to your site, what information they want to find and when they are likely to return.
Site maps allow you to plan the structure of a site.
Wireframes allow you to organize the information that will need to go on each page.
Design is about communication. Visual hierarchy helps visitors understand what you are trying to tell them.
You can differentiate between pieces of information using size, color, and style.
You can use grouping and similarity to help simplify the information you present.
Chapter 19: Practical Information
Search engine optimization helps visitors find your sites when using search engines.
Analytics tools such as Google Analytics allow you to see how many people visit your site, how they find it, and what they do when they get there.
To put your site on the web, you will need to obtain a domain name and web hosting.
FTP programs allow you to transfer files from your local computer to your web server.
Many companies provide platforms for blogging, email newsletters, e-commerce and other popular website tools (to save your writing them from scratch).
波多黎各「自古以来」是美国领土不可分割的一部分,入境需要「美国签证」。这里没有从中国直飞的飞机,需要从美国本土进行转机才能到达。如果你持有美国的学生即 F1 签证,即使在已经过期的情况下,如果你仍在美国境内,也可以直接去波多黎各,因为从美国本土飞入的航班不需要过关。
行程安排
第几天
上午
下午
晚上
地点
Day 1
New York 飞到 San Juan
开车前往 Fajardo,游玩酒店的独有岛屿
住在 El Conquistador 酒店
Fajardo
Day 2
开车前往 El Yunque National Forest
游玩热带雨林
住在 El Conquistador 酒店
Fajardo
Day 3
坐船前往 Culebra Island
浮潜和划船
住在 El Conquistador 酒店
Fajardo
Day 4
飞往 Vieques Island
傍晚去 Bio Bay
住在 W Retreat & Spa 酒店
Vieques Island
Day 5
开车前往 San Juan
游玩老城区
住在 Ritz-Carlton 酒店
San Juan
Day 6
退租车
飞回 New York
抵达 New York
New York
花费表
项目
商家
价格
纽约到圣胡安往返机票
Delta
340*2=680
Vieques Island 往返机票
Air Flamenco
68*2=136
租车 五天
Charlie Car Rental
200
Fajardo 酒店三晚
El Conquistador Resort, A Waldorf Astoria Resort
800
Vieques Island 酒店一晚
W Retreat & Spa - Vieques Island
360
San Juan 酒店一晚
The Ritz-Carlton, San Juan
380
浮潜以及 Kayak
Kayaking Puerto Rico
93*2=186
Bio Bay Tour
Fun Brothers
55*2=110
上表只包含机票、酒店以及游玩项目花费,不包括其他费用。
租车点评
Charlie Car Rental(推荐指数:☆☆☆☆☆)
这次选择 Charlie Car Rental 是通过 Yelp 查看 Review 选到的,我也是推荐这家租车公司。在 San Juan 机场的确也有类似 Enterprise Rent-A-Car, National Car Rental 之类的大公司,但普通的车并多,我准备预定的时候只有 SUV 和 Jeep 之类的大车了,而且很贵。同时,你也会发现还有很多小的汽车租赁公司价格十分便宜,网上查看的时候也是备货充足,如果预定的话,在网上是不需要交定金的,要到现场再交钱。但根据 Yelp 的评论来看,很多这样小公司在你到了之后会告诉你,你预定那款车型没有了,然后推荐你选择更贵的车。
Charlie Car Rental 也是网上预约不需要提前交钱,但 Yelp 上的评价很好,去了之后也是提供了同款车。
另外提一下租车保险问题,在美国租车需要包含两项保险,第一个是 Liability Insurance,第二个是 Collision/Loss and Damage Waiver。简单来说,在出事故时,Liability Insurance 只赔付事故中造成的对方车辆和人员损失,而 Collision/Loss and Damage Waiver 只赔付保险人驾驶的车辆相关的损失。在租车的时候,租车公司需要你购买这两项保险。
在 Charlie Car Rental 购买 Liability Insurance 价格是 15刀/天,同时使用 Chase Sapphire Preferred 信用卡所附赠的 Collision/Loss and Damage Waiver 的保险。
Tips:
网上预约,不需要提前缴费。
最好是使用信用卡来 cover 所需要的 Collision/Loss and Damage Waiver 保险。
Google Map 上下载好离线地图,不是所有地方都是有信号的。
酒店点评
El Conquistador Resort(推荐指数:☆☆☆☆)
这是一家非常大的 Resort,隶属于 Hilton 集团下。
El Conquistador 酒店集各种餐饮娱乐于一身,有露天游泳池、水上公园、网球场、跳舞池、沙滩以及一个私人岛屿。私人岛屿需要通过酒店的轮渡坐船过去,大约15分钟的海上航向就到了,私人岛屿上也有很多游玩项目,如果入住这里,一定要去一次。同时这里还有水上公园,有时间的话也可以过去玩玩,水上公园不是很大,只有几个水上项目可以玩。
El Conquistador 酒店的缺点就是房间一般,湿度比较大,一进入房间就能感觉到一股多年的湿气迎面扑来,但毕竟这里坐落于海边,游客玩的项目都全部涉水,把「水」带回房间也可以理解。
Tips:
地址是 1000 El Conquistador Avenue, Fajardo, 00738 PR。快到的时候会看到 El Conquistador Resort 的标志,从标志旁边的正路开进去就行了。
这家酒店不算很大,但很精致。当坐的小飞机降落到 Vieques Island 的机场后,隔壁就有 W 酒店的候机室,你可以在这里等待酒店的 Shuttle 车过来接你,在第二天离开的时候也可以在这里稍作休息。W 酒店有两个沙滩,同时还有几个露天游泳池,其中一个是无边游泳。 W 酒店装修非常出色,服务也非常到位。要知道,在 Vieques Island 这个小岛上,连锁的酒店就只有 W 酒店这一家,其他的全是民宿即 Airbnb。
房间也很华丽,浴缸干净地想让人马上泡个澡,床当然也没话说,睡得非常舒服。
W 酒店没有什么缺点,如果需要在 Vieques Island 上过夜,强烈推荐入住这里,你不会后悔的。
Tips:
如果你是坐飞机到 Vieques Island 的,下飞机后出门左边就是 W 酒店候机室,等一会儿就有 shuttle 来接你。
The Ritz-Carlton, San Juan 是隶属 Marriott 旗下的酒店。坐落于 San Juan 机场附近。
The Ritz-Carlton, San Juan 也有一个大沙滩和若干个游泳池,酒店内部还有一个赌场与酒吧。因为这家酒店历史悠久,整体布局和装修稍显老派,感觉让人一般,房间也是一般的布局,并没有什么心意。
如果你需要在 San Juan 住一晚,不是很推荐住在这里,380刀一晚的房价与其包含的东西有所出入,这个价格我觉得会有更好的选择。
Tips:
地址是 6961 Ave Gobernadores, Carolina, PR 00797
酒店有赌场,可以去玩几把,哈哈。
游玩项目点评
El Yunque National Forest 热带雨林之行(推荐指数:☆☆☆)
由于 Puerto Rico 属于美国的缘故,这个 El Yunque National Forest 成为美国唯一一个在热带雨林中的国家公园。在里面,你可以走 Trail 来体验热带森林多变的气候,冷不丁地给你来一场不期而遇的暴雨,同时还有观望台可以瞭望大片大片的森林,也有个小型瀑布供游人嬉戏。
Tips:
El Yunque National Forest - El Portal Visitor Center,这是最开始的接待中心,有卖一些小纪念品的。从这个就开始热带雨林之旅了。
这里是一些景点的里程指示牌,一路往山上开车,看到路牌就知道了景点了。
带雨衣,防虫喷雾剂,雨鞋,换洗的干衣服干袜子。
里程牌
景点
4.2km
El Portal Visitors Center
7.8km
Gift shop and little roadside restaurant “La Muralla”
8.3km
La Coca Fall The falls can be seen from the road
9.1km
Yokahu Oberservation Tower
10.4 km
Big tree trail to La mina falls
11.6 km
Sierra Palms Recreation area
12km
Palo Colorado Visitor Center and other trail heads
Culebra Island 的浮潜及 Kayak(推荐指数:☆☆☆☆☆)
来波多黎各怎么能不浮潜呢? Culebra Island 有着世界顶级的沙滩,具体排名第几记不清了,但这里的沙子真是又细又划。Kayak 和浮潜加起来有好几个小时。预定是在 Kayaking Puerto Rico 这个网上上找到的。包含主岛往返 Culebra Island 的船票,和到 Culebra Island 后的游玩项目。
主岛到 Culebra Island 可以选择做小型飞机和轮渡,这次选择 Kayaking Puerto Rico 团后,他们提供轮渡船票,船票并不贵,往返船票也就十几块钱,但数量非常有限,每天早上就只有两班从主岛到 Culebra Island 的轮渡,如果要选择自己去排队买船票的话,需要六七点钟就得到码头排队买票,并不是很值得。
坐船大概半个小时就能到 Culebra Island, 然后 Kayaking Puerto Rico 的工作人员会直接接上我们上 Bus,开到他们在岛上的基地,简单地吃点东西后,换上装备就直接去 Kayaking 了。
Bio Bay 应该属于来波多黎各的必备项目,绝对不能错过!这次预定是在 Fun Brothers 上订 Bio Bay Tour,体验非常好,也是非常满意的!
主岛到 Vieques Island 也是有轮渡和小型飞机的选项,我们选择是坐小型飞机到小岛上。在 Air Flamenco 上买了主岛到 Vieques Island 的往返机票,每人 68 美元,飞机很快,大概 13 分钟就能飞到了,同时也可以领域空中俯瞰岛屿的美景。
因为只需要天非常黑的情况下,才能领略到荧光海的魅力,所以我们预定的是晚上 9 点到 11 点的 Tour。到达 W 酒店后,酒店人员可以帮你安排往返 Bio Bay 的出租车,下午稍微休息了一会儿后,五六点就准备出发去集合区域。虽说那里是 Vieques Island 上的一个商业聚居区,其实是一个很小的地方,几家餐馆,几个卖工艺品的摊位,还有几户民宿。在好好地吃了一顿晚饭后,九点就坐上了 Fun Brothers 接我们去 Bio Bay 的 Bus。
前往 Bio Bay 的道路异常曲折,由于全是坑坑洼洼的泥地,全程几户是坐过山车式的方式上下颠簸才到达。到达后,天已经完全漆黑,坐上 Kayak 后就在荧光湖上游荡了。这是一次非常别致的体验,每当浆在水里划下的时候,水就会泛起淡淡的亮光,加上 Kayak 的小船底部是纯玻璃制的,你就可以看到湖中泛起的点点荧光,异常美丽又惊奇。
Tips:
因为环保的需要,去 Bio Bay 不能喷防虫的喷雾,如果喷的话,他们的工作人员会制止你的,不过蚊子也不是很多,没什么问题。
去 Bio Bay 的路十分颠簸,注意保护屁股。
San Juan 老城区(推荐指数:☆☆☆☆)
坐上返航的飞机会后主岛后,就直接驱车一小时回到 San Juan,利用下午和晚上的时间游览下 San Juan 老城区。在快进入老城区的时候,找个停车场把车停了,然后步行进去。因为老城区的街道很狭窄,基本没法停车。
San Juan 的老城区犹如一道道彩虹,各种各样的颜色涂在不同的西班牙式建筑的墙壁,让人忍不住按下相机的快门。当然,这里是非常理想的拍照之地,多拍点照片准备发朋友圈吧,绚丽多姿的图片不会让你失望的。
Tips:
老城区很难停车,需要把车停的城外,然后步行进去,可以选择的停车场是 Estacionamiento Covadonga,PR-38, San Juan, 00901 或者是 Dona Fela Parking,如果都没有,附近可以随便找一个,走路大概 5~10 分钟就能到老城区了。
可以参观两个古堡:Castillo de San Cristóbal 和 SAN CRISTOBAL CASTLE
Alamofire is an HTTP networking library written in Swift.
Alamofire can solve most HTTP problems while you are building Apple applications with Swift. It’s really super powerful library if you need to handle any HTTP problems.
POST with a string as body
If you want to make a POST request, and you also have a string as body to send this request. Here is the way to do in Alamofire.
There is an integer represents duration time in seconds, I want to convert it into 4:34:54 and 4 Hours 34 Minutes 54 seconds format. Is there any way to solve this problem?
Answer
The following code is based on Swift 3.
Format One
1 2 3 4
let interval = 27005 let formatter = DateComponentsFormatter() formatter.allowedUnits = [.hour, .minute, .second] let formattedString = formatter.string(from: TimeInterval(interval))!
In this way, formattedString will be 7:30:05
Format Two
1 2 3 4
let interval = 27005 let formatter = DateComponentsFormatter() formatter.unitsStyle = .full let formattedString = formatter.string(from: TimeInterval(interval))!
In this way, formattedString will be 7 hours, 30 minutes, 5 seconds