Presentation is loading. Please wait.

Presentation is loading. Please wait.

Some SpotLight in CSS. CSS element>element Selector div>p.

Similar presentations


Presentation on theme: "Some SpotLight in CSS. CSS element>element Selector div>p."— Presentation transcript:

1 Some SpotLight in CSS

2 CSS element>element Selector div>p

3 div>p { background-color:yellow; } I live in Duckburg My best friend is Mickey

4

5 The element>element selector is supported in all major browsers. Note: For element>element to work in IE, a must be declared

6 CSS element+element Selector How to style all elements that are placed immediately after a element.

7 .intro { background-color:black; color:#FFF; } div+p { background-color:yellow; } Welcome to My Homepage My name is Donald I live in Duckburg My best friend is Mickey I am a duck

8

9 The element+element selector is supported in all major browsers. Note: For element+element to work in IE, a must be declared.

10 CSS * Selector How to select all elements, and set their background color

11 * { background-color:yellow; } Welcome to My Homepage TA Group I live in Iran Persian TA

12

13 The * selector styles all elements. The * selector can also style all elements inside other elements:

14 div * { background-color:yellow; }.intro { text-align:right; } TA Persian TA I live in Tehran Tehran

15

16 CSS [attribute~=value] Selector The [attribute~=value] selector styles elements with the specified attribute containing the specified value. Note: The value has to be a whole word, either alone (title="flower") or separated by white- space (title="plant flower klematis").

17 [title~=flower] { border:5px solid yellow; } The image with a title attribute containing the value "flower" gets a yellow border. Note: For [ attribute ~= value ] to work in IE, a DOCTYPE must be declared.

18

19 CSS [attribute|=value] Selector The [attribute|=value] selector styles elements with the specified attribute starting with the specified value. Note: The value has to be a whole word, either alone, like lang="en", or followed by a hyphen( - ), like lang="en-us".

20 [lang|=en] { background:yellow; } [test|=ss] { background:#999; } Hello! Hi! Ello! Hi! Hei! BABBAk...

21

22 CSS element element Selector Separate selectors with a white-space, to style elements inside elements. The element element selector styles elements inside elements.

23 div p { background-color:yellow; } Title Test 1 test 2 test 3

24

25 CSS element,element Selector Separate selectors, using commas, to style more than one element with the same style. The element,element selector styles all elements with either one of the specified tagnames

26 div,p { background-color:yellow; } Welcome to My Homepage Test 1 Test 2 Test 3

27

28 CSS :lang Selector The :lang() selector styles all elements with the lang attribute set to a specified value. The :lang() selector is supported in all major browsers. Note: For :lang() to work in IE, a must be declared.

29 p:lang(it) { background:yellow; } div:lang(iran) { background:yellow; } test1 test2 test 3 test 4 Note: For :lang to work in IE, a DOCTYPE must be declared.

30

31 CSS :after Selector The :after selector inserts content after the selected element(s). Use the CSS content property to specify the content.

32 p:after { content:"- Babak Tavatav"; } Web Design HTML5 Note: For :before to work in IE, a DOCTYPE must be declared.

33

34 CSS :before Selector The :before selector inserts content in front of the selected element(s). Use the CSS content property to specify the content.

35 p:before { content:"Read this::-"; } ASP.net HTML5 Note: For :before to work in IE, a DOCTYPE must be declared.

36

37 CSS :first-child pseudo-element first-child pseudo-element styles the specified selector, only if it is the first child of its parent.

38 p:first-child { background-color:yellow; } Welcome to My Homepage This paragraph is not the first child of its parent Note: For :first-child to work in IE, a DOCTYPE must be declared.

39

40 CSS :first-letter pseudo-element first-letter pseudo-element adds a style to the first letter of the specified selector.

41 p:first-letter { background-color:yellow; } Welcome Babak Tavatav Web design HTMl & CSS

42

43 CSS :first-line pseudo-element The :first-line pseudo-element adds a style to the first line of the specified selector.

44 p:first-line { background-color:yellow; } WWF's Mission Statement this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test

45

46 CSS :focus Selector The :focus selector styles the element that has focus.

47 input:focus { background-color:yellow; } Click inside the text fields to see a yellow background: First name: Last name:

48

49 CSS :hover Selector The :hover selector styles elements when you hover (mouse over) them.

50 a:hover { background-color:yellow; } Mouse over the links to see a yellow background: Avand SabadeKala

51

52 CSS :visited Selector The :visited selector styles links to visited pages. Note: The :link selector does not style links to pages you have not visit. Tip: Use the :link selector to style links to not visited pages. Tip: Use the :hover selector to style links when you mouse over them. Note: :hover MUST come after :link and :visited (if they are specified) in the CSS definition in order to be effective! Tip: Use the :active selector to style links when you click on them. Note: :active MUST come after :hover (if specified) in the CSS definition in order to be effective!

53 a:visited { background-color:yellow; } SabadeKala Avand WROX Note: The :link selector does not style links to pages you have already visited.

54

55 The End


Download ppt "Some SpotLight in CSS. CSS element>element Selector div>p."

Similar presentations


Ads by Google