我在this thread閱讀如何更改Jupyter筆記本電腦的寬度的單元格(我使用second answer動態地這樣做)。此方法消除了左右灰色邊框。如何消除瀏覽器中Jupyter/ipython筆記本週圍的灰色邊框?
但是,這仍在文檔的頂部和底部處留下灰色邊框。我怎樣才能消除這種情況,讓細胞躺在乾淨的石板上?
我在this thread閱讀如何更改Jupyter筆記本電腦的寬度的單元格(我使用second answer動態地這樣做)。此方法消除了左右灰色邊框。如何消除瀏覽器中Jupyter/ipython筆記本週圍的灰色邊框?
但是,這仍在文檔的頂部和底部處留下灰色邊框。我怎樣才能消除這種情況,讓細胞躺在乾淨的石板上?
因此,使用「檢查元素」在筆記本和學習CSS的絲毫之後,似乎下面的工作
from IPython.core.display import display, HTML
display(HTML("<style>"
+ "#notebook { padding-top:0px !important; } "
+ ".container { width:100% !important; } "
+ ".end_space { min-height:0px !important; } "
+ "</style>"))
頂部線條去除頂部的灰色邊緣,中間線條去除邊緣,底部線條去除底部的灰色邊緣。 <style>
,</style>
之間的內容當然也可以加入this thread之後的~/.jupyter/custom/
中的custom.css
文件;我的文件包含行
/* Modifications to notebook format */
#notebook { padding-top:0px !important; } /* eliminate top gray */
.container { width:100% !important; } /* eliminate side gray */
.end_space { min-height:0px !important; } /* eliminate bottom gray */
我將在下面添加到我的CSS
*{margin:0;
padding:0;
}
html, body, .container{
margin:0!important;
padding:0!important;
}
而且應該擺脫在頂部和底部的額外空間,以及雙方的。如果這是你通過一個邊界是指一條線,你可以
看到評論後更新添加border:0;
到HTML,身體的CSS:
從你給出的解決方案,你也可以做同樣的與高度(height:100%;!important
),但在我的經驗設置100%的高度屬性不如寬度有效(因爲高度更動態)首先嚐試html/body的東西。與HTML /機身內嵌樣式
例如屬性:
from IPython.core.display import display, HTML
display(HTML("<style> *{margin:0; padding:0;} html, body, .container{margin:0;!important padding:0;!important} .container { width:100% !important;}</style>"))
你可以將html和body css也添加到內聯樣式中,但是css樣式表比內聯樣式更可取。 –
似乎不適合我;它仍然留下頂部/底部邊距。我根本不瞭解HTML/CSS,但是我使用了Inspect Element,發現'.end_space {min-height:0px!important; ''擺脫**底部**邊緣。不知道如何擺脫頂部邊距。您的解決方案是否適合您? –
在容器和div中,設置margin和padding爲!important。你可以拿出高度的東西 –
你的意思是1票或99票的答案?你可以通過點擊答案下方的共享來分享答案的網址...答案網址會出現,你可以複製 –
謝謝,更新了問題的鏈接。 –
編輯答案.. –