基於 Bootstrap 的 UI 擴充套件:StyleBootstrap

2015-08-08    分類:CSS框架、Web應用開發、開源軟體、首頁精華1人評論發表於2015-08-08

本文由碼農網 – 小峰原創,轉載請看清文末的轉載要求,歡迎參與我們的付費投稿計劃

StyleBootstrap是一款基於Bootstrap的開源UI框架,目前基於Bootstrap風格的擴充套件外掛很多,比如BootswatchBootMetro等,這些之前我們都有做過介紹。StyleBootstrap應該說是對Bootstrap樣式風格的一種擴充套件,除了一些基本的按鈕、表單、選單之外,StyleBootstrap還設計了功能全面的顏色拾取器,非常不錯。

StyleBootstrap的特點

  • 擁有Bootstrap簡潔高效的特點,配置靈活。
  • 相容任一版本的Bootstrap。
  • 功能強大的調色盤是其最大的特色。

StyleBootstrap相關元件例項及程式碼

一、導航條

StyleBootstrap的導航條功能比較強大,除了普通的選單項,還可以有下拉選單和表單的各種組合,其更大的亮點是可以自定義調節選單的樣式,包括上下邊距、背景色等引數。

核心CSS程式碼:

.navbar-inner {
  background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2);
  background-image: -ms-linear-gradient(top, #ffffff, #f2f2f2);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));
  background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2);
  background-image: -o-linear-gradient(top, #ffffff, #f2f2f2);
  background-image: linear-gradient(top, #ffffff, #f2f2f2);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'ffffff, endColorstr='#'f2f2f2, GradientType=0);
}

.navbar .brand {
  padding: 8px 20px 12px;
  font-size: 20px;
  color: #727272;
}

.navbar .divider-vertical {
  height: 41px;
  background-color: #ffffff;
  border-right: 1px solid #c6c6c6;
}

.navbar .nav > li > a {
  padding: 10px 10px 11px;
  font-size: 14px;
  color: #666666;
}

.navbar .nav > .active > a,
.navbar .nav > .active > a:hover,
.navbar .nav > .active > a:focus {
  color: #424242;
}

二、按鈕

同樣的,StyleBootstrap的按鈕不僅可以設定豐富的色彩,而且同樣支援下拉,外觀非常不錯。

核心CSS程式碼:

.btn {
  color: #333333;
  background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
  background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: linear-gradient(top, #ffffff, #e6e6e6);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'ffffff, endColorstr='#'e6e6e6, GradientType=0);
}

.btn:hover,
.btn:active,
.btn.active,
.btn.disabled,
.btn[disabled] {
  color: #333333;
  background-color: #e6e6e6;
}

.btn-primary {
  background-color: #006dcc;
  color: #ffffff;
  background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
  background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
  background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
  background-image: -o-linear-gradient(top, #0088cc, #0044cc);
  background-image: linear-gradient(top, #0088cc, #0044cc);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'0088cc, endColorstr='#'0044cc, GradientType=0);
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary.active,
.btn-primary.disabled,
.btn-primary[disabled] {
  background-color: #0044cc;
}

.btn-warning {
  color: #ffffff;
  background-image: -moz-linear-gradient(top, #fbb450, #f89406);
  background-image: -ms-linear-gradient(top, #fbb450, #f89406);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
  background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
  background-image: -o-linear-gradient(top, #fbb450, #f89406);
  background-image: linear-gradient(top, #fbb450, #f89406);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'fbb450, endColorstr='#'f89406, GradientType=0);
}

.btn-warning:hover,
.btn-warning:active,
.btn-warning.active,
.btn-warning.disabled,
.btn-warning[disabled] {
  background-color: #f89406;
}

.btn-danger {
  color: #ffffff;
  background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
  background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
  background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
  background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
  background-image: linear-gradient(top, #ee5f5b, #bd362f);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'ee5f5b, endColorstr='#'bd362f, GradientType=0);
}

.btn-danger:hover,
.btn-danger:active,
.btn-danger.active,
.btn-danger.disabled,
.btn-danger[disabled] {
  background-color: #bd362f}

.btn-success {
  color: #ffffff;
  background-image: -moz-linear-gradient(top, #62c462, #51a351);
  background-image: -ms-linear-gradient(top, #62c462, #51a351);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
  background-image: -webkit-linear-gradient(top, #62c462, #51a351);
  background-image: -o-linear-gradient(top, #62c462, #51a351);
  background-image: linear-gradient(top, #62c462, #51a351);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'62c462, endColorstr='#'51a351, GradientType=0);
}
.btn-success:hover,
.btn-success:active,
.btn-success.active,
.btn-success.disabled,
.btn-success[disabled] {
  background-color: #51a351;
}

.btn-info {
  color: #ffffff;
  background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4);
  background-image: -ms-linear-gradient(top, #5bc0de, #2f96b4);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));
  background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4);
  background-image: -o-linear-gradient(top, #5bc0de, #2f96b4);
  background-image: linear-gradient(top, #5bc0de, #2f96b4);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'5bc0de, endColorstr='#'2f96b4, GradientType=0);
}
.btn-info:hover,
.btn-info:active,
.btn-info.active,
.btn-info.disabled,
.btn-info[disabled] {
  background-color: #2f96b4;
}

三、取色器

StyleBootstrap的取色器功能很強大,你可以從色版上選擇一種顏色,也可以輸入顏色的十六進位制值,同時你可以拖動色塊區域快速定位你需要的顏色。

運用了jPicker外掛,關於jPicker外掛的CSS程式碼,你可以在這裡下載,並引用到專案中,然後通過以下CSS程式碼呼叫:

@media all 
{
	#jPicker { margin: 0px 8px; text-align: left; }
	#jPicker ul { font-size: 15px; margin: 0px 0px 0px 15px; padding: 0px; }
	#jPicker ul li { list-style: disc; padding: 2px 0px; }
	#jPicker ul li ul { margin-bottom: 10px; }
	#jPicker ul li ul li { list-style: circle; }
	#jPicker p { font-size: 13px; padding: 0px 10px; }
	#jPicker hr { clear: both; }
	#jPicker h2.jPicker { font-size: 16px; padding: 20px 10px; }
	#jPicker code { color: #8bd; font-size: 14px; font-weight: bold; }
	#jPicker pre { background: #eee; border: 1px solid #000; color: #000; display: block; font-size: 11px; margin: 10px 5px; padding: 5px; }
	#jPicker span { font-size: 13px; text-align: center; }
	#jPicker a { color: #ff8050; }
	#jPicker input { font-size: 13px; padding: 2px 5px; }
	#jPicker h2 { font-size: 16px; margin: 10px 0px; }
}

總結

總的來說,StyleBootstrap作為一款CSS框架還是不錯的,更多關於StyleBootstrap的使用,你也可以直接前往其官方網站進行檢視。

本文連結:http://www.codeceo.com/article/stylebootstrap-base-bootstrap.html
本文作者:碼農網 – 小峰
原創作品,轉載必須在正文中標註並保留原文連結和作者等資訊。]

相關文章