SEARCH !!

2014/01/27

關於文字爆出去


-- text-overflow --
文字超出邊界時的處理方法,須配合 overflow: hidden; 和 white-space: nowrap; 使用。可設為:
--> overflow: hidden; white-space: nowrap; text-overflow: ellipsis;

clip:切去超出的部分不顯示,此為預設值。
ellipsis:用 "..." 表示後面還有文字未顯示出來。
ellipsis-word:使用 "a€|" 表示後面還有文字未顯示出來。主要瀏覽器都沒支援此項。
inherit:繼承父元素的特徵值。

***************************************************************************************************

-- white-space --
文字中的空白的處理方法。空白字包括:空白,TAB,跳行字(line feed, carriage return, form feed)。可設為:

normal:連續的空白字都縮減為一個空白,長行遇到右邊界會跳行分為兩行,此為預設值。
pre:不縮減空白字,維持原狀。
pre-line:Firefox, Safari, Chrome 的定義是,連續的空白字會縮減為一個空白;跳行字(newline)保留,會跳行;長行也會跳行。IE 的定義是,連續的跳行會保留。
pre-wrap:Firefox, Safari, Chrome 的定義是,不縮減空白字;跳行字會跳行;長行也會跳行。IE 的定義是,連續的跳行字會縮減為一個跳行。
nowrap:連續的空白字會縮減為一個空白,不跳行。
inherit:繼承父元素的特徵值。

***************************************************************************************************

-- word-wrap --
指定是否可以將完整的長字分為二,以免長字超出邊界。適用於英文,通常英文用音節規則來斷字。可設為:

break-word:可以任意斷字,不依循音節規則。
normal:長字會維持原狀,超出邊界,此為預設值。
inherit:繼承父元素特徵。

使用此項,必須先將 text-wrap 特徵設為 normal 或 suppress。例外的是 IE 沒有 text-wrap,一律可以用此項。

***************************************************************************************************

-- word-break --
word-break 屬性主要是用來設定亞洲語言(Chinese, Japan, Korea)及非亞洲語言文字的斷行規則。

normal       Break words according to their usual rules
break-all  Lines may break between any two letters
keep-all   Breaks are prohibited between pairs of letters

2014/01/21

How To Take Care of Your Smartphone Battery the Right Way

Your smartphone is a minor miracle, a pocket-sized computer that can fulfill almost every whim. But none of its superpowers matter a bit if it runs out of juice. With removable batteries becoming more and more rare, you've got to take good care of the one you got. Fortunately, it's not to hard keep the lithium-ion powering your everything machine happy if you follow a few simple rules.
Obviously, the first rule for extending your battery life is not using up all your battery life playing candy crush and walking around with Wi-Fi and GPS enabled when you're not using either and really, really need your phone to last that extra hour. But aside from that, there are some basic rules for care and charging, and they're the simplest baseline for a healthy battery.

Top it off

You may vaguely recall hearing something about rechargeable batteries and the "memory effect." You know, that if you don't "teach" your rechargeable batteries their full potential by taking them from totally full to totally empty, they'll "forget" part of their capacity. Well forget all that. Right now. It's wrong.
Battery memory is a real thing, but it applies to nickel-based batteries; your trusty sidekick (literal Sidekick or otherwise) doubtlessly has a lithium-ion battery, and it needs to be treated a little differently. Specifically, it should be topped off whenever you get the chance.
To get the most out of a lithium-ion battery, you should try to keep it north of 50 percent as much as possible. For the most part going from all the way full to all the way empty won't help; in fact, it'll do a little damage if you do it too often. That said, it's smart to do one full discharge about once a month for "calibration," but don't do it all the time. Running the whole gamut on a regular basis won't make your battery explode or anything, but it will shorten its lifespan.
But! You don't want to have it charging all the time either; lithium-ion batteries can get overheated. Luckily for you, your charger is smart enough to help with this, and will cut your phone off for a spell once it's full. And to complicate matters a little further your battery doesn't particularly like being all the way full either. In fact, your battery will behave the best if you take it off the charge before it hits 100 percent, and leaving it plugged when it's already full is going to cause a little degradation.
So if you're really particular about optimizing your battery's life, you should try to go from around 40 percent to around 80 percent in one go, and then back down whenever possible. A bunch of tiny charges isn't as bad as going from 100 down to zero all the time, but it's not optimal either.

Keep it cool

It's easy to worry about bad charging habits thanks to the training we've had from old rechargeable batteries, but lithium-ion batteries have a worse enemy: heat. Your smartphone's battery will degrade much much faster when it's hot, regardless of whether it's being used or just sitting around doing nothing.
At an average temperature of 32 degrees fahrenheit, a lithium-ion battery will lose six percent of its maximum capacity per year. At 77 degrees, that number jumps to 20 percent, and at 104 degrees it's a whopping 35. Sure, it's not exactly practical (or sane) to keep your phone in the fridge, but it's worth going out of your way to prevent long stays in hot cars and the like.

Avoid wireless charging

Wireless charging is can be incredibly convenient if your phone can do it, but it's not without its disadvantages. The inductive, wireless chargers out there today have this nasty habit of generating a fair bit of waste heat. And while wasted energy is just a bummer in general, that heat will also toast your battery in the process. That's no bueno. It's a little less convenient, but standard plug-in charging is going to keep your battery in better shape, especially if you're some place warm to begin with.

Never go to zero

Obviously, using your battery is going to make it degrade. But it's going to slowly die even if you just leave that iPad in the closet for a bit. There's a trick to minimizing that inevitable aging though: leave it a little bit of juice.
If you're going to be shelving any lithium-ion battery for a long time, try to leave it with at least 40 percent battery power to tide it over. Lithium-ion batteries don't hemmorage power at 30 percent a month like nickel-metal-hydride batteries do; they'll lose maybe five to ten percent of their charge each month.
And when lithium-ion batteries get too low—like, literally zero percent—they get seriously unstable, and dangerous to charge. To prevent explosion-type disasters if you do try to charge one, lithium-ion batteries have built-in self-destruct circuits that will disable (read: destroy) the battery for good, if it reaches rock bottom. And sure, that'll save you from a face full of battery-acid, but it'll also leave you short one battery.

Don't sweat it too much

It's easy to get protective of your battery, but it's also easy to get lazy. And that's fine, because as long as you're not a complete idiot, you'll be OK. Typically, a lithium-ion battery lasts for three to five years, and chances are you're going to want to swap out your gadgets sometime in that window anyway. The slight damage of a technically bad idea like leaving your phone plugged in all night every night, or using wireless charging, might be worth the convenience.
Still, it's pretty easy to keep your battery reasonably healthy just by avoiding particularly egregious torture like letting your phone discharge from full to zero every single day, or leaving it in a hot car all the time. And the next time you make it back home with power to spare, you'll thank yourself for it.


2014/01/02

如何讓 div 維持正方形

如何讓 div維持正方形

利用padding可以吃 width % 的值去推開
這樣寬高就會有相同的依據

EX:
width: 50%;
height: 0;
padding-bottom: 50%; <-- 會以width為基準的20%延伸:

padding-bottom: 75%; /* 4:3 aspect ratio */

也可用 :before 或 :after 去塞一個 padding-bottom: 50%; 的東西