Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS
CSS
  1. การจัดตำแหน่งแบบ Relative (Relative Positioning) ใน CSS

    การจัดตำแหน่งแบบ Relative (position: relative) วาง element ตามปกติใน document flow แล้วค่อยเลื่อนจากตำแหน่งเดิมด้วย top/right/bottom/left ตัวอย่างโค้ด <!DOCTYPE html> <html> <head> <style> div.demo {    position: relative;    color: white;    b

  2. การเย่อยหน้าข้อความด้วย CSS text-indent

    ใช้คุณสมบัติ text-indent เพื่อกำหนดการเย่อยบรรทัดแรกของย่อหน้า (paragraph) ตัวอย่างที่ 1: หน่วย px <!DOCTYPE html> <html> <head> <style> div {    text-indent: 30px; } </style> </head> <body> <h1>Demo Heading</h1> <div> <p>

  3. การทำซ้ำพื้นหลังใน CSS (background-repeat)

    การทำซ้ำพื้นหลังใน CSS ใช้กำหนดว่าภาพพื้นหลังจะทำซ้ำบนหน้าเว็บอย่างไร ใช้คุณสมบัติ background-repeat ค่าที่ใช้ได้มีดังนี้: background-repeat: repeat | repeat-x | repeat-y | no-repeat | initial | inherit; ตัวอย่างที่ 1: repeat-x (ทำซ้ำแนวนอน) <!DOCTYPE html> <html> <head> <style

  4. การตั้งค่าตำแหน่งพื้นหลังด้วย CSS (background-position)

    ตำแหน่งพื้นหลัง (Background position) ใช้สำหรับกำหนดตำแหน่งเริ่มต้นของภาพพื้นหลัง ใช้คุณสมบัติ background-position ตัวอย่างที่ 1: left center <!DOCTYPE html> <html> <head> <style> body {    background-image: url("https://www.tutorialspoint.com/images/Swift.png

  5. การตั้งค่ากฎคอลัมน์ใน CSS3 (column-rule)

    เพื่อตั้งค่ากฎ (เส้นแบ่ง) ระหว่างคอลัมน์ ให้ใช้ shorthand column-rule ซึ่งรวมคุณสมบัติ: column-rule-width: ความกว้างเส้นแบ่ง column-rule-style: สไตล์เส้นแบ่ง column-rule-color: สีเส้นแบ่ง ค่ารวมได้ดังนี้: column-rule: column-rule-width column-rule-style column-rule-color | initial | inherit; ตัวอย

  6. ฟังก์ชัน CSS translate() สำหรับเลื่อนตำแหน่ง

    ฟังก์ชัน translate() ใน CSS ใช้สำหรับเลื่อนตำแหน่งองค์ประกอบในทิศทางแนวนอนและแนวตั้ง ตัวอย่างที่ 1: translateX เท่านั้น (50px, 0) <!DOCTYPE html> <html> <head> <style> #demo1 {background-color: hsla(140, 100%, 50%, 0.8);} #demo2 {background-color: hsla(130, 100%, 50%, 0.6);}

  7. Absolute Positioning ใน CSS (ตำแหน่งแบบสัมบูรณ์)

    เมื่อใช้ Absolute Positioning องค์ประกอบจะถูกจัดตำแหน่งสัมพันธ์กับพ่อที่มีการจัดตำแหน่ง (positioned ancestor) ใกล้ที่สุด ตัวอย่าง <!DOCTYPE html> <html> <head> <style> div.demo1 {    position: relative;    color: white;    background-color: oran

  8. ทำความเข้าใจหน่วย CSS Absolute และ Relative Units

    CSS Absolute Units (หน่วยสัมบูรณ์) หน่วยความยาวแบบสัมบูรณ์มีค่าคงที่สัมพันธ์กัน ใช้เมื่อรูปแบบเอาต์พุททราบล่วงหน้า หน่วยหลักมีดังนี้: ลำดับหน่วยและคำอธิบาย 1cm - เซนติเมตร 2mm - มิลลิเมตร 3in - นิ้ว (1in = 96px = 2.54cm) 4px - พิกเซล (1px = 1/96 ของ 1in) * หน่วยหลักหน้

  9. การเปลี่ยนตำแหน่งตัวหมายเลขรายการด้วย CSS (list-style-position)

    คุณสมบัติ list-style-position ใช้สำหรับกำหนดตำแหน่งของตัวหมายเลขรายการ (list-item markers) ตัวอย่าง: outside vs inside <!DOCTYPE html> <html> <head> <style> ul.demo1 {    list-style-position: outside; } ul.demo2 {    list-style-position: inside; } </st

  10. การใช้ภาพเป็นตัวหมายเลขรายการใน CSS (list-style-image)

    เพื่อใช้ภาพเป็นตัวหมายเลขรายการ ให้ใช้คุณสมบัติ list-style-image ใน CSS ตัวอย่าง: ใช้ภาพ Swift เป็น marker สำหรับ ul และ ol <!DOCTYPE html> <html> <head> <style> ul.demo1 {    list-style-image: url(https://www.tutorialspoint.com/images/Swift.png); } ol.demo2 { &nbs

  11. การตั้งค่าความสูงบรรทัดด้วย CSS (line-height)

    เพื่อตั้งค่าความสูงบรรทัด ให้ใช้คุณสมบัติ line-height ค่าที่ใช้ได้มีดังนี้: line-height: normal | number | length | percentage | initial | inherit; ตัวอย่างที่ 1: ใช้ตัวเลข (unitless) - แนะนำ <!DOCTYPE html> <html> <head> <style> div {    line-height: 1.9; } </s

  12. การลบเส้นใต้ลิงก์เริ่มต้นด้วย CSS

    เพื่อลบเส้นใต้เริ่มต้นของลิงก์ด้วย CSS โค้ดดังนี้: ตัวอย่างที่ 1: ลบ underline สำหรับ link และ visited <!DOCTYPE html> <html> <head> <style> a:link {    color: blue;    text-decoration: none; } a:visited {    color: blue;    text-decor

  13. การจัดสไตล์ลิงก์ด้วย CSS (Styling Links)

    เพื่อจัดสไตล์ลิงก์ด้วย CSS ต้องรู้สถานะ (states) ของลิงก์ 4 สถานะ: link, visited, hover, active ใช้ pseudo-classes ของ anchor element: a:link - ลิงก์ที่ยังไม่ได้เยี่ยมชม a:visited - ลิงก์ที่เยี่ยมชมแล้ว a:hover - เมื่อเมาส์ชี้อยู่เหนือลิงก์ a:active - ลิงก์ที่กำลังถูกคลิก (กดค้าง) ตัว

  14. Static Positioning ใน CSS (ตำแหน่งคงที่)

    เมื่อใช้ Static Positioning องค์ประกอบจะไม่ได้รับผลกระทบจากคุณสมบัติ top, bottom, left, และ right ใช้ position: static (ค่าเริ่มต้นของทุกองค์ประกอบ) ตัวอย่าง <!DOCTYPE html> <html> <head> <style> div.static {    position: static;    color: white;   &

  15. ฟังก์ชัน CSS3 rotate3d() สำหรับหมุน 3 มิติ

    ฟังก์ชัน rotate3d() ใน CSS ใช้สำหรับหมุนองค์ประกอบในพื้นที่ 3 มิติ กำหนดจำนวนและมุมการหมุนเป็นพารามิเตอร์ของ rotate3d() ตัวอย่างที่ 1: หมุนรอบแกน (1,1,1) 45 องศา <!DOCTYPE html> <html> <head> <style> .demo {    transform: rotate3d(1, 1, 1, 45deg); } .skew_img { &nb

  16. การตั้งค่าขนาดฟอนต์ด้วยคีย์เวิร์ดใน CSS

    สำหรับการตั้งค่าขนาดฟอนต์ด้วยคุณสมบัติ font-size สามารถใช้คีย์เวิร์ดได้ ซึ่งแบ่งเป็น 2 กลุ่ม: 1. Relative-size keywords (คีย์เวิร์ดขนาดสัมพัทธ์) larger - ใหญ่กว่าพ่อ 1 ขนาด smaller - เล็กกว่าพ่อ 1 ขนาด 2. Absolute-size keywords (คีย์เวิร์ดขนาดสัมบูรณ์) xx-small - เล็กมากที่สุด x-small -

  17. การเพิ่มเอฟเฟกต์ Sepia ให้ภาพด้วย CSS3

    เพื่อเพิ่มเอฟเฟกต์ Sepia (สีน้ำชา/โบราณ) ให้ภาพด้วย CSS3 ใช้ค่า sepia() สำหรับคุณสมบัติ filter ตัวอย่าง: sepia 100% <!DOCTYPE html> <html> <head> <style> img.demo {    filter: sepia(100%); } </style> </head> <body> <h1>Learn Spring Framework

Total 1584 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:26/80  20-คอมพิวเตอร์/Page Goto:1 20 21 22 23 24 25 26 27 28 29 30 31 32