2019年7月15日 星期一

將物件置中的方法之一

大物件的css


  1. display: flex;

小物件的css
          margin: auto;

就可以達到小物件的置中了




  1.  

2019年6月11日 星期二

固定標題

<script>
$(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 495) { /* 要滑動到選單的距離 */
$('.header-bg').addClass('navFixed'); /* 幫選單加上固定效果 */
} else {
$('.header-bg').removeClass('navFixed'); /* 移除選單固定效果 */
}
});
});
</script>

2019年5月28日 星期二


文字閃爍

https://codepen.io/elliewu/pen/KLxzWQ

iframe框架語法

iframe


方法一:用iframe放入要植入的網頁
<div class=””>
<iframe src=”/public/sport/html/index.html” frameborder=”0" marginheight=”0" marginwidth=”0" scrolling=”no” width=”100%” height=”870" style=”width: 1000px; display: block; margin: 0 auto;” allowtransparency=”true”></iframe>
</div>

寫法
<iframe src="嵌入目標" width="250px" height="300px" frameborder="0" scrolling="no"></iframe>
方法二:function放入
主頁
<!DOCTYPE html>
<html>
<head>
 <meta charset=”UTF-8">
 <title>demo演示</title>

</head>
<body>
<!--顶部导航 -->
<header></header>
<! — 顶部导航 over - ->
<!- -中部主体- ->
 <p>···代码省略···</p>
<! — -中部主体 over- ->
<! — footer — ->
<footer></footer>
<! — footer over — ->
<script src=”/js/jquery.min.js”></script>
<script>
 /*导入头部和尾部*/
$(document).ready(function(){
 $(“header”).load(“/header.html”);
 $(“footer”).load(“/footer.html”);
});
</script>

</body>
</html>

footer頁面
<!--footer.html页面-->
<footer>
    <ul class="g-flex">
       <li class="g-flex-auto"><a href="#" class="i-b">首页</a></li>
       <li class="g-flex-auto"><a href="#" class="i-b">分类</a></li>
       <li class="g-flex-auto"><a href="#" class="i-b">订单</a></li>
       <li class="g-flex-auto"><a href="#" class="i-b">我的</a></li>
    </ul>
 </footer>

             方法三:php語法

<?php
require ('header.php');
?>
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>

<?php
require ('footer.php');
?>



2019年5月9日 星期四

改變寬度,就會改變內容

https://codepen.io/mukiwu/pen/OPWxjg


$(document).ready(function(){
  if(matchMedia) {
    var mq = window.matchMedia( "(min-width: 500px)" );
   
    //
    mq.addListener(WidthChange);
   
    //
    WidthChange(mq);
  }
 
  function WidthChange(mq){
    if (mq.matches) {
      // window width is at least 500px
      $(".a").text("match");
    }
    else {
      // window width is less than 500px
      $(".a").text("nomatch");
    }
  }
})

---
也可以這樣寫

if (mq.matches) {
// window width is at least 768px
$("header nav ul").show(100);
}
else {
// window width is less than 768px
$("header nav ul").hide(100);

 其他rwd參考
http://slides.com/mukiwu/rwd-experience#/

2019年5月2日 星期四

不让padding影响元素的宽度

div { box-sizing: border-box; }

input css

去掉藍色hover邊框

給input加上 如下樣式, focus或者 hover等 根據問題改動即可
input:focus {
outline: 0;
-webkit-box-shadow: inset000rgba(0,0,0,.075),000#333;
box-shadow: inset000rgba(0,0,0,.075),000#333;
}


原文網址:https://kknews.cc/zh-tw/digital/ogn3q4m.html

改變光暈顏色

input[type=text]:focus,input[type=password]:focus,textarea:focus{
 
 transition:border linear .2s,box-shadow linear .5s;
 -moz-transition:border linear .2s,-moz-box-shadow linear .5s;
 -webkit-transition:border linear .2s,-webkit-box-shadow linear .5s;
 outline:none;border-color:rgba(241,39,242,.75);
 box-shadow:0 0 8px rgba(241,39,232,.5);
 -moz-box-shadow:0 0 8px rgba(241,39,232,.5);
 -webkit-box-shadow:0 0 8px rgba(241,39,232,3);
 
}

將物件置中的方法之一

大物件的css margin : auto ; display :   flex ; 小物件的css           margin : auto ; 就可以達到小物件的置中了