2014-02-27 15 views

回答

2

編輯:尤卡指出,第一次嘗試沒有工作在Firefox,所以這裏的,似乎效果更好的編輯例如:http://codepen.io/pageaffairs/pen/Glkng

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<style> 

p {width: 50%; padding-bottom: 2em; line-height: 1.3em;} 
i {position: relative;} 
b {position: absolute; right: 0; bottom: -1.4em; white-space: nowrap;} 

</style> 
</head> 
<body> 

<p><span>Vegetation is the basic instrument the creator uses to set all of nature in motion.<i><b>Antoine Lavoisier</b></i></span></p> 

</body> 
</html> 

第一次嘗試(在故障Firefox,就像Jukka指出的那樣):

也許這樣? http://codepen.io/pageaffairs/pen/qKfsD

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<style> 

p {width: 340px; padding-bottom: 2em; line-height: 1.3em;} 
span {position: relative;} 
b {position: absolute; bottom: -1.4em; right: 0; display: inline-block; white-space: nowrap;} 

</style> 
</head> 
<body> 

<p><span>Vegetation is the basic instrument the creator uses to set all of nature in motion. <b>Antoine Lavoisier</b></span></p> 

</body> 
</html> 
+1

工程上Chrome和IE,而不是在Firefox(在'B'元件被定位成抵靠的右邊緣上的最後一行)。 –

+0

是的,好點。我已經稍微更新了答案以解決該問題。 –

+0

好吧,但是如果由於段落的寬度而在最後一行出現小文本時仍然存在問題 - 那麼該名稱會「流血」到左邊......(將段落寬度設置爲大約200px,那麼您應該看看我的意思。) – CBroe

相關問題