html如何用百分比绝对定位,绝对定位元素的宽度百分比是多少?

我绝对定位的元素被设置为100%的宽度,但即便如此,当它呈现时,它会创建一个水平滚动条并超出页面的边界。上面静态定位的元素在浏览器中查看时看起来更短,即使它们也跨越了整个宽度。绝对定位元素的宽度百分比是多少?

@charset "utf-8";

#wrapper {}

h1,

h2 {

color: #1E1E1E;

font-style: normal;

font-weight: 400;

}

h1 {

margin-top: 0px;

margin-bottom: 0px;

padding-top: 0px;

padding-bottom: 20px;

}

#wrapper #hero {

max-height: 400px;

overflow: hidden;

}

#menulink {

margin: 0;

text-align: center;

background-color: #1E1E1E;

}

#menulink a {

text-transform: uppercase;

color: white;

font-weight: 200;

text-decoration: none;

display: block;

padding-top: 0.1em;

padding-bottom: 0.1em;

}

#navlinks {

position: absolute;

width: 100%;

margin: 0;

padding: 0;

text-align: center;

background-color: rgba(0, 0, 0, 0.53);

}

#navlinks a {

display: block;

padding-top: 10px;

padding-bottom: 10px;

font-weight: 400;

text-decoration: none;

text-transform: uppercase;

}

#wrapper #hero img {

max-width: 100%;

}

figure {

width: 400px;

margin-left: auto;

margin-right: auto;

}

figure img {

max-width: 100%;

}

.grayscale {

filter: grayscale(100%);

}

.grayscale:hover {

filter: grayscale(0%);

}

Bayside Beat

GoldenGateBridge-001.jpg

Bayside Beat keeps you informed of the best places to see, eat, and sleep in the City by the Bay.

Riding the Cable Cars

No visit to San Francisco is complete without a ride on the iconic cable cars that climb up the vertiginous hills of the city. Of the twenty-three lines established between 1873 and 1890, three remain: two routes from downtown near Union Square to

Fisherman's Wharf, and a third route along California Street.

The cable cars rely on cables running constantly beneath the road’s surface. The driver—or gripman—uses a lever to grip the cable to pull the car and its passengers up the hill. The gripman requires not only great strength, but also great skill. He

needs to know where to release the cable to coast over crossing cables and points. The conductor works in close cooperation with the gripman, operating the brake at the rear of the car to prevent it from running out of control on the downward slopes.

lotus_flowers-wide.jpg

The cable car terminus near Union Square.

Although the cable cars are now mainly a tourist attraction, they’re still used by local commuters to get to and from work. The California Street line is particularly popular among commuters on weekdays.

Cable Car Tips

A single ride on a cable car costs $7. If you plan to travel around the city, it’s often cheaper to buy a Muni Passport, which gives you unlimited rides on San Francisco’s extensive public transport system, including the cable cars (but not the BART

subway system). Even a single-day passport ($20) will save you money if you make a return trip, and stop off to visit Chinatown one way.

There are often long lines at the cable car terminus, particularly on the Powell-Mason and Powell-Hyde routes. If you don’t want to wait, try walking a few stops along the route. The conductor usually leaves a small number of places to pick up passengers

on the way. The California Street route is generally less crowded (but not as spectacular).

© Copyright 2013–16 Bayside Beat

+0

请包括像您与前面的问题做了提问内的代码。不要强迫读者点击链接查看您的代码。 –

+0

它相对于父定位元素(不是静态的)。确保在绝对定位元素上使用'left:0;'和'top:0'。 –

+0

@Mr。外星人谢谢你,那是做的。 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值