Programming/css2016. 1. 11. 14:02



The id Selector

The id selector uses the id attribute of an HTML element to select a specific element.

The id of an element should be unique within a page, so the id selector is used to select one unique element!

To select an element with a specific id, write a hash (#) character, followed by the id of the element.

The style rule below will be applied to the HTML element with id="para1":


The class Selector

The class selector selects elements with a specific class attribute.

To select elements with a specific class, write a period (.) character, followed by the name of the class.

In the example below, all HTML elements with class="center" will be red and center-aligned:


[링크 : http://www.w3schools.com/css/css_syntax.asp]


id는 유일한 거라고 하지만.. 크롬이나 ie에서 실험적으로 해봐도

경고나 에러를 띄우진 않는데.. 머가 맞는걸려나..

[링크 : http://okky.kr/article/89313]

[링크 : http://www.homejjang.com/07/class_id.php

'Programming > css' 카테고리의 다른 글

css float overflow  (0) 2018.08.20
css 우선순위  (0) 2018.08.09
html css 적용 방법  (0) 2016.01.11
css margin / padding  (0) 2015.09.24
css body background  (0) 2015.09.22
Posted by 구차니