2017年2月2日 星期四

Bootstrap dropdown menu don't work in IE8, 下拉選單在IE8出不來

解決方法:
加上filter:none !important;

.navbar-inverse .nav li.dropdown.open > .dropdown-toggle,
.navbar-inverse .nav li.dropdown.active > .dropdown-toggle,
.navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle,
.nav,
.navbar,
.navbar-inverse .navbar-inner {
filter:none!important;
background-image: none;
}

參考網址:https://github.com/twbs/bootstrap/issues/6548

2016年12月20日 星期二

h1 margin-top 會影響到父層DIV 產生多餘的 margin-top

h1 margin-top 會影響到父層DIV 產生多餘的 margin-top

HTML
<div class="parent"> 
<h1>HI HI HI</h1> 
</div>


css
.parent{margin:0;}
h1{margin: 50px auto; }


解決方案
在父層div加上overflow:auto

.parent{margin:0; overflow:auto;}

參考來源
http://stackoverflow.com/questions/20689575/css-margin-top-of-h1-affects-parents-margin

2016年12月9日 星期五

owlcarousel 100%高的用法

1. 先去GITHUB 下載 owlcarousel 2.0新版
https://github.com/OwlCarousel2/OwlCarousel2

2. 把CSS放到html裡面
CSS 放到<head>裡面

<link rel="stylesheet" href="dist/owlcarousel/owl.carousel.min.css">

<link rel="stylesheet" href="dist/owlcarousel/owl.theme.default.min.css">


3. JS 放到<body>最下面,記得要先引用jquery

<!-- jQuery -->
<script src="//code.jquery.com/jquery.js"></script>

<!--貓頭鷹跑馬燈的JS-->
<script src="dist/owlcarousel/owl.carousel.min.js"></script>
<!--啟用貓頭鷹-->
<script>
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
nav:true,
items:1
})
</script>
4. html 我用背景的跑馬燈
<div class="owl-carousel">
    <div class="item" style="background-image: url(img/b1.jpg);"><h4>1</h4></div>
    <div class="item" style="background-image: url(img/b2.jpg);"><h4>2</h4></div>
</div>
5. 100高的設定 100% height CSS 設定

html,body{height: 100%;}
body{min-height:100%;}
.owl-carousel{height: 100%;}
.owl-carousel .owl-stage-outer{height: 100%;}
.owl-stage{height: 100%;}
.owl-item {height: 100%;}
.owl-item .item{height: 100%; background-size: cover;background-position: center center;}

2016年11月29日 星期二

圖片置中的好方法,Image Vertical Align

外層DIV 高度與行高一致
裡面的IMG vertical-align:middle

.proudImg{margin:10px;overflow: hidden;height: 200px;line-height:200px;}
.proudImg img{vertical-align:middle;}

2016年11月17日 星期四

RWD

媒體查詢寫法

最大的畫面只到767 手機專用
@media only screen and (max-width: 767px){
}

最大的畫面只到991 平板專用
@media only screen and (max-width: 991px){
}
畫面在1200~992
@media(min-width: 768px) and (max-width: 1200px){
}

2016年11月16日 星期三

css hover 過後 圖片放大的感覺

a img{
-webkit-transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    -moz-transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    -o-transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    -ms-transform: scale(1);
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -o-transform: scale(1);
    transform: scale(1);
}

a:hover img{
 -ms-transform: scale(1.02);
    -webkit-transform: scale(1.02);
    -moz-transform: scale(1.02);
    -o-transform: scale(1.02);
    transform: scale(1.02);
}

http://www.erikjohanssonphoto.com/work

2016年11月4日 星期五

一些注意事項

1. img 放在DIV 裡,底部多出一段padding
Ans: img display:block

2.slidebar 好用的js  側開 上開 下開
Adam Charles Smith
 https://www.adchsm.com/slidebars/