반응형

1. 선택자[속성] , 선택자[속성=값] - 특정한 속성이 있는 태그 선택


img[alt]

img 중에 alt 속성을 가진 것만 찾는다.

input[type=password]

input 중에 type password 인 것만 찾는다.

div#header

아이디가 headerdiv 선택하는 같은 방법이다.

div[id=header] 

div[id="header"] 

 


2. 선택자[속성~=값] , 선택자[속성|=값] - 속성 안의 값이 특정 값을 단어로 포함하는 문서 객체를 선택(띄어쓰기 포함)


 img[alt~="test"]  <img src="aa.jpg" alt="test photo" /> test 뒤에 띄어쓰기가 있는경우도 찾는다.
 <img src="bb.jpg" alt="camera test" /> test 앞에 띄어쓰기가 있는경우도 찾는다. 
 img[alt|="test"]  <img src="aa.jpg" alt="test-photo" /> test 뒤에 - 있는 경우 찾는다.

 


3. 선택자[속성^=값] , 선택자[속성$=값] , 선택자[속성*=값]


선택자[속성^=값]

속성 중 값으로 시작하는 것 선택

 a[href="http://"]  a(anchor)에 요소 href 중에 속성명이 http:// 로 시작하는 것을 찾는다.

선택자[속성$=값] 

속성 중 값으로 끝나는 것 선택

img[src$=png] img src png로 끝나는 img만 선택

선택자[속성*=값]

속성 중 값을 조금이라도 포함되어있으면 선택

img[alt*=test] img alt 안에 test가 들어간 것 모두 선택

반응형
반응형

비디오 태그는 웹페이지에서 동영상을 볼 수 있게 만들어주는 기능을 수행한다. 

원래 HTML5 시대가 오기 전에는 비디오도 윈도 미디어 플레이어 또는 플래시와 같은 플러그인을 사용해서만 볼 수 있었다. 

하지만 HTML5 시대가 오면서 웹표준만으로 동영상을 볼 수 있게 되었다.


*유튜브는 플래시를 사용해서 동영상을 재생하게 설계되었지만 http://www.youtube.com/html5  에 들어가서 HTML5 기능을 실행하면 플래시 없이 동영상을 볼 수 있다.


video 태그의 속성

<video poster="http://placehold.it/640x360" width="640" height="360" controls="controls">

    <source src="Kalimba.mp4" type="video/mp4" />

    <source src="Kalimba.webm" type="video/webm" />

</video>


속성 이름

값 

설명 

src

URL 

비디오파일의 경로지정 

height 숫자 비디오의 높이를 지정
width 숫자 비디오의 너비를 지정
poster URL 비디오 준비중일 때의 이미지 파일 경로 지정
muted "muted", "", - 음소거 

controls

"controls", "" , -  

비디오 재생 도구를 출력할지 지정 

autoplay 

"autoplay", "", - 

비디오를 자동 재생할지 지정 

loop 

"loop", "", - 

비디오를 반복할지 지정 

preload

"none", "metadata", "auto" 

음악을 재생하기 전에 모두 불러올지 지정

none : 사용자가 비디오를 필요로하지 않을 것이라고 명시, 미리 다운로드 하지 않음

metadata : 사용자가 비디오를 필요로 하지 않을 것이지만, 기본정보(크기,첫프레임,오디오길이 등)는 가져온다.

auto : 사용자가 비디오를 필요로 하고 미리 다운로드를 한다 (기본값)

 


 *웹브라우저에서 지원하는 비디오파일 형식

 

 IE

크롬 

파이어폭스 

사파리 

오페라 

MP4(H.264+ACC)

O 

O 

X 

O 

X 

WebM(VP8+Vorbis)

X 

O 

O 

X

O 

OGV(Theora+Vorbis)

X 

O 

O 

X 

 


※ video.js 플러그인

웹브라우저마다 표시되는 video태그의 형태가 일관되지 않으므로 웹페이지를 디자인할 때 문제가 될 수 있다.

또한 IE8이하에서는 video 태그가 동작하지 않는다. 이러한 문제를 해결 할 수 있는 간단한 플러그인이 video.js플러그인 이다.

IE8에서는 자동으로 플래시에 담겨 동영상이 재생된다.


http://videojs.com

<!DOCTYPE HTML>

<html lang="ko">

<head>

<meta charset="UTF-8">

<title>video.js</title>

<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet" />

<script src="http://vjs.zencdn.net/c/video.js"></script>

</head>

<body>

<video width="640" height="360" controls="controls" class="video-js vjs-default-skin" data-setup="{}">

    <source src="Wildlife.mp4" type="video/mp4" />

    <source src="Wildlife.ogv" type="video/ogv" />

</video>

</body>

</html>

반응형
반응형

오디오 태그는 웹브라우저에서 플러그인의 도움 없이 음악을 재생할 수 있게 만들어주는 HTML5 태그 이다.

HTML5에서 추가된 기능이므로 IE8 이하에서는 사용할 수 없다.


audio 태그의 속성

<audio src="Kalimba.mp3" controls="" autoplay="" loop="" preload="auto"></audio>


속성 이름

값 

설명 

src

URL 

음악파일의 경로지정 

controls

"controls", "" , -  

음악 재생 도구를 출력할지 지정 

autoplay 

"autoplay", "", - 

음악을 자동 재생할지 지정 

loop 

"loop", "", - 

음악을 반복할지 지정 

preload

"none", "metadata", "auto" 

음악을 재생하기 전에 모두 불러올지 지정

none : 사용자가 오디오를 필요로하지 않을 것이라고 명시, 미리 다운로드 하지 않음

metadata : 사용자가 오디오를 필요로 하지 않을 것이지만, 기본정보(크기,첫프레임,오디오길이 등)는 가져온다.

auto : 사용자가 비디오를 필요로 하고 미리 다운로드를 한다 (기본값)

 


※브라우저마다 지원하는 오디오 확장자 형식이 다르기 때문에 모든 브라우저에서 오디오태그가 실행 되기 위해서 source 태그를 사용한다.


 

<audio controls="controls">

    <source src="Kalimba.mp3" type="audio/mp3" />

    <source src="Kalimba.ogg" type="audio/ogg" />

</audio>


 *웹브라우저에서 지원하는 음악파일 형식

 

 IE

크롬 

파이어폭스 

사파리 

오페라 

MP3

O 

O 

X 

O 

X 

OGG 

X 

O 

O 

O 

O 

WAV 

X 

O 

O 

X 

 


source 태그의 type 속성을 입력하지 않아도 상관없다. 

하지만 type 속성을 입력하지 않으면 웹브라우저가 음악 파일을 내려받은 뒤에 재생 가능한 파일인지 확인하므로 트래픽이 낭비된다. 

따라서 type 속성을 꼭 지정해준다.

반응형
반응형

우분투에서 사용하는 apt 패키지 관리자의 기본 저장소를 변경하는 방법입니다.

/etc/apt/sources.list 파일을 편집하면 되는데요. 아래는 우분투 기본 저장소인데 아무래도 해외이다보니 속도가

느립니다. kr.archive.ubuntu.com 도 있긴 한데 이것도 역시 좀 느립니다. 그래서 daum 에서 제공하는 저장소를

많이 사용하게 되는데요.

 

deb http://archive.ubuntu.com/ubuntu trusty main
deb http://archive.ubuntu.com/ubuntu trusty-updates main
deb http://security.ubuntu.com/ubuntu trusty-security main
deb http://archive.ubuntu.com/ubuntu trusty universe
deb http://archive.ubuntu.com/ubuntu trusty-updates universe

 

아래는 daum 의 저장소로 변경한 파일입니다. vi 로 작업하실 경우는 간단히 치환 명령어를 사용하면 됩니다.

 

:%s/archive.ubuntu.com/ftp.daum.net/g

:%s/security.ubuntu.com/ftp.daum.net/g

deb http://ftp.daum.net/ubuntu trusty main
deb http://ftp.daum.net/ubuntu trusty-updates main
deb http://ftp.daum.net/ubuntu trusty-security main
deb http://ftp.daum.net/ubuntu trusty universe
deb http://ftp.daum.net/ubuntu trusty-updates universe

 

저장한 후에 apt-get update 한번 해 주시고 apt-get upgrade 도 하시되 중간에 grub 을 변경할지 물어볼 경우 반드시

현재 버전을 유지하는 걸로 하시기 바랍니다. 아니면 가상서버 부트섹터가 변경되어서 부팅이 안 될 수가 있습니다.

 

출처 http://blog.fun25.co.kr/%EC%9A%B0%EB%B6%84%ED%88%AC-apt-%EA%B8%B0%EB%B3%B8-%EC%A0%80%EC%9E%A5%EC%86%8C-%EB%B3%80%EA%B2%BD%ED%95%98%EA%B8%B0/

반응형
반응형
var mobilecheck = function() {
 var check = false;
 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
 return check;
}

 

반응형
반응형

(function() {
    var link = document.createElement('link');
    link.type = 'image/x-icon';
    link.rel = 'shortcut icon';
    link.href = '/resources/pubtree/images/favicon.ico';
    document.getElementsByTagName('head')[0].appendChild(link);
}());

반응형
반응형

1.<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" class="inputTypeText" style="width:170px;border:1px solid #7f9db9;"

2.onkeydown="javascript: if (event.keyCode == 13) {chkform();}"/>


onkeydown="javascript: if (event.keyCode == 13) {chkform();}" 이런식으로 체크한다.

함수 호출로 chkform();

01.function chkform()
02.{
03.var f = document.fo_search;
04.if(f.addr1.value == '')
05.{
06. alert('지역을 선택해주세요.');
07. f.addr1.focus();
08. return false;
09.}else{
10. document.fo_search.submit();
11.}
12.}


 

 

document.fo_search.submit();
이런식으로 form의 submit 실행

반응형
반응형

CSS3 gives us the ability to create rounded corners with the border-radius property. But as you might already know, this new feature is not recognized in Internet Explorer 8 (IE8) and its earlier versions. So when you apply CSS3 Border Radius to an element, it still appears as a box with pointed tips.

 

 

You may find a lot of different advice on the Internet suggesting you ignore IE8. You wish you could do so. But if you’re working on a website for a government institution or a bank, you may not have a choice. You still have to make the website look as nice as it does in modern browsers, which includes the ability to apply CSS3 Border Radius.

If you really have to make your website IE8-ready, while being able to use the CSS3 feature, we have just the tip for you.

CSS3Pie

CSS3Pie is a kind of polyfill for CSS3 decorative features. Aside from CSS3 Border Radius that we’re going to discuss in this article, CSS3Pie also supports Box Shadow and Gradients, though it’s limited to the Linear Gradient type.

Download CSS3Pie (here). Put it inside your project directory – I placed it in the css folder. As you can also see from the screenshot below, I’ve created one stylesheet as well as one HTML file.

 

 

Open the stylesheet in code editor and set one of the elements in the HTML file with rounded corners, like so:

1
2
3
4
5
6
7
8
.border-radius {
    height: 100px;
    width: 100px;
    background-color: #2ecc71;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
}

As the element’s width and height are both 100px, and the border-radius is set to 50px, the element will become a circle:

 

 

In IE8, as we expect, it would still be a square (sigh), but don’t worry.

 

 

To enable the rounded corner effect, insert this line: behavior: url(css/pie.htc);, like so.

1
2
3
4
5
6
7
8
9
.border-radius {
    height: 100px;
    width: 100px;
    background-color: #2ecc71;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
    behavior: url(css/pie.htc);
}

Note that the file path in url()has to be either an absolute path or relative to the HTML file. You can also add this line in a separate file.

You may have a stylesheet that is designated for Internet Explorer. You can put behavior: url(css/pie.htc); within that file, but ensure that it’s declared within the same CSS selector, like so.

1
2
3
4
/* declared in ie.css */
.border-radius {
    behavior: url(css/pie.htc);
}

Refresh the page in IE8. The rounded corner should now come into effect (ta-da!). It should work in IE7 as well.

 

 

Troubleshooting

Internet Explorer may behave unexpectedly. If this does not work (maybe the rounded corner does not take effect, or the selected element has disappeared), adding the position and zoom property should solve the problem:

1
2
3
4
5
6
7
<style>
.border-radius {
    behavior: url(<?php echo get_template_directory_uri() ;?>/css/pie.htc);
    position: relative;
    zoom: 1;
}
</style>

Using CSS3 Pie in WordPress

You have finished putting your website in HTML form. You also utilize pie.htc in the website to enable CSS3 in IE8. At this stage, you are ready to transform the website into a functioning WordPress theme. In this case, as WordPress is dynamic, where pages may serve in different level URLs, we have to specify an absolute path.

You can either change the path in CSS like this:

1
2
3
4
5
.border-radius {
    behavior: url(http://localhost/{website}/wp-content/themes/{the_theme}/css/pie.htc);
    position: relative;
    zoom: 1;
}

Or add internal styles in the header.php, this way:

1
2
3
4
5
6
7
<style>
.border-radius {
    behavior: url(<?php echo get_template_directory_uri() ;?>/css/pie.htc);
    position: relative;
    zoom: 1;
}
</style>

Final Thought

Having cool things such as CSS3 Border Radius work in IE8 is fascinating, and CSS3Pie makes that happen, while giving us one less reason to hate IE8.

반응형

'웹프로그래밍 > CSS' 카테고리의 다른 글

Background-size for IE7,8  (0) 2015.04.24
CSS3 구조선택자  (0) 2015.04.24
CSS 동위선택자, 상태선택자  (0) 2015.04.24
CSS 속성선택자  (0) 2015.04.24
텍스트 줄바꿈 처리 word-break, white-space  (0) 2015.04.09

+ Recent posts