تحتوي مكتبة امثلة اكواد CSS على تمارين عديدة وشاملة تساعدك لفهم وتعلم تنسيق وترتيب صفحات الويب
مثال عن محدد عنصر Element selector:
Every paragraph will be affected by the style.
Me too!
And me!
مثال عن محدد id selector:
Hello World!
This paragraph is not affected by the style.
مثال عن محدد عنصر class selector:
Red and center-aligned heading
Red and center-aligned paragraph.
مثال عن المحدد العام universal selector:
Hello world!
Every element on the page will be affected by the style.
Me too!
And me!
مثال عن المحدد لمجموعة group selector:
Hello World!
Smaller heading!
This is a paragraph.
مثال عن لون الخلفية:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
مثال عن لون النص:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
مثال عن لون حدود النص:
Hello World
Hello World
Hello World
مثال عن طريقة تحديد الألوان بطريقتين:
rgb(255, 0, 0)
rgb(0, 0, 255)
rgb(60, 179, 113)
rgb(238, 130, 238)
rgb(255, 165, 0)
rgb(106, 90, 205)
In HTML, you can specify colors using RGB values.
#000000
#3c3c3c
#787878
#b4b4b4
#f0f0f0
#ffffff
By using equal values for red, green, and blue, you will get different shades of gray.
مثال عن تغيير لون الخلفية لصفحة HTML:
Hello World!
This page has a light blue background color!
مثال عن تغيير لون الخلفية لعنصر محدد:
CSS background-color example!
This is a text inside a div element.
This paragraph has its own background color.
We are still in the div element.
مثال عن وضع صورة كخلفية:
Hello World!
This page has an image as the background!
مثال عن وضع صورة ثابتة كخلفية:
The background-attachment Property
The background-attachment property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page).
Tip: If you do not see any scrollbars, try to resize the browser window.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
The background-image is fixed. Try to scroll down the page.
مثال عن تحديد عرض الحدودborder width :
The border-width Property
This property specifies the width of the four borders:
Some text.
Some text.
Some text.
Some text.
Some text.
Some text.
Note: The "border-width" property does not work if it is used alone.
Always specify the "border-style" property to set the borders first.
مثال عن تحديد لون الحدود border color:
One-colored border!
Two-colored border!
Three-colored border!
Four-colored border!
Note: The "border-color" property does not work if it is used alone. Use the "border-style" property to set the borders first.
مثال عن تحديد نمط الحدود border style:
The border-style Property
This property specifies what kind of border to display:
A dotted border.
A dashed border.
A solid border.
A double border.
A groove border.
A ridge border.
An inset border.
An outset border.
No border.
A hidden border.
A mixed border.
مثال عن تحديد كل خصائص الحدود border:
This is some text in a paragraph.
This is some text in a paragraph.
This is some text in a paragraph.
This is some text in a paragraph.
مثال عن تحديد الهامش لعنصر من كل الاتجاهات:
Using individual margin properties
This div element has a top margin of 100px, a right margin of 150px, a bottom margin of 100px, and a left margin of 80px.
مثال عن تحديد الهامش لعنصر باستخدام اربع قيم:
The margin shorthand property - 4 values
This div element has a top margin of 25px, a right margin of 50px, a bottom margin of 75px, and a left margin of 100px.
مثال عن تحديد الهامش لعنصر (توسيط العنصر) :
Use of margin:auto
You can set the margin property to auto to horizontally center the element within its container. The element will then take up the specified width, and the remaining space will be split equally between the left and right margins:
This div will be horizontally centered because it has margin: auto;
مثال عن تحديد الهامش لعنصر من كل الاتجاهات:
Using individual padding properties
This div element has a top padding of 50px, a right padding of 30px, a bottom padding of 50px, and a left padding of 80px.
مثال عن تحديد الهامش لعنصر باستخدام اربع قيم:
The padding shorthand property - 4 values
This div element has a top padding of 25px, a right padding of 50px, a bottom padding of 75px, and a left padding of 100px.
مثال عن تحديد الهامش لعنصر (box-sizing) :
Padding and element width
This div is 300px wide.
The width of this div is 350px, even though it is defined as 300px in the CSS.
مثال عن تغيير لون لنص:
This is heading 1
This is an ordinary paragraph. Notice that this text is blue. The default text color for a page is defined in the body selector.
Another paragraph.
مثال عن محاذاة النص:
Heading 1 (center)
Heading 2 (left)
Heading 3 (right)
The three headings above are aligned center, left and right.
مثال عن تزيين النص:
This is heading 1
This is heading 2
This is heading 3
مثال عن زيادة الفراغات بين الكلمات:
This is heading 1
This is heading 2
مثال عن تغيير نوع الخط لنص:
CSS font-family
This is a paragraph, shown in the Times New Roman font.
This is a paragraph, shown in the Arial font.
This is a paragraph, shown in the Lucida Console font.
مثال عن تغيير حجم الخط لنص:
This is heading 1
This is heading 2
This is a paragraph.
مثال عن تغيير نمط الخط لنص:
This is a paragraph in normal style.
This is a paragraph in italic style.
This is a paragraph in oblique style.
مثال عن تغيير كل خصائص الخط لنص:
The font Property
This is a paragraph. The font size is set to 20 pixels, and the font family is Arial.
This is a paragraph. The font is set to italic and bold, the font size is set to 12 pixels, the line height is set to 30 pixels, and the font family is Georgia.
مثال عن ايقونات Google:
Google Icons
Some Google icons:
cloud
favorite
attachment
computer
traffic
Styled Google icons (size and color):
cloud
cloud
cloud
cloud
مثال عن ايقونات Bootstrap:
Bootstrap Icons
Some Bootstrap icons:
Styled Bootstrap icons (size and color):
مثال عن تغيير لون الرابط قبل و بعد زيارته:
CSS Links
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.
Note: a:active MUST come after a:hover in the CSS definition in order to be effective.
مثال عن تغيير لون الخلفية للرابط قبل و بعد زيارته:
CSS Links
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.
Note: a:active MUST come after a:hover in the CSS definition in order to be effective.
مثال عن تغييرنمط المؤشر على الرابط قبل و بعد زيارته:
Mouse over the words to change the cursor.
auto
crosshair
default
e-resize
help
move
n-resize
ne-resize
nw-resize
pointer
progress
s-resize
se-resize
sw-resize
text
w-resize
wait
مثال عن تغيير الماركر للقوائم غير المرتبة:
- Circle type
- Tea
- Coca Cola
- Disc type
- Tea
- Coca Cola
- Square type
- Tea
- Coca Cola
- Armenian type
- Tea
- Coca Cola
- Cjk-ideographic type
- Tea
- Coca Cola
- Decimal type
- Tea
- Coca Cola
- Decimal-leading-zero type
- Tea
- Coca Cola
- Georgian type
- Tea
- Coca Cola
- Hebrew type
- Tea
- Coca Cola
- Hiragana type
- Tea
- Coca Cola
- Hiragana-iroha type
- Tea
- Coca Cola
- Katakana type
- Tea
- Coca Cola
- Katakana-iroha type
- Tea
- Coca Cola
- Lower-alpha type
- Tea
- Coca Cola
- Lower-greek type
- Tea
- Coca Cola
- Lower-latin type
- Tea
- Coca Cola
- Lower-roman type
- Tea
- Coca Cola
- Upper-alpha type
- Tea
- Coca Cola
- Upper-latin type
- Tea
- Coca Cola
- Upper-roman type
- Tea
- Coca Cola
- None type
- Tea
- Coca Cola
- inherit type
- Tea
- Coca Cola
مثال عن تغيير الماركر للقوائم (صورة):
CSS Lists
The list-style-image property specifies an image as the list item marker:
- Coffee
- Tea
- Coca Cola
مثال عن تغيير لون ونمط القوائم:
Styling Lists With Colors:
- Coffee
- Tea
- Coca Cola
- Coffee
- Tea
- Coca Cola
مثال عن وضع حدودد للقوائم:
Full-width bordered list:
- Coffee
- Tea
- Coca Cola
مثال عن جدول مخطط:
Striped Table
For zebra-striped tables, use the nth-child() selector and add a background-color to all even (or odd) table rows:
First Name
Last Name
Points
Peter
Griffin
$100
Lois
Griffin
$150
Joe
Swanson
$300
Cleveland
Brown
$250
مثال عن جدول يتغير نمطه عند وضع مؤشر الماوس عليه:
Hoverable Table
Move the mouse over the table rows to see the effect.
First Name
Last Name
Points
Peter
Griffin
$100
Lois
Griffin
$150
Joe
Swanson
$300
Cleveland
Brown
$250
مثال عن جدول متجاوب:
Responsive Table
A responsive table will display a horizontal scroll bar if the screen is too
small to display the full content. Resize the browser window to see the effect:
To create a responsive table, add a container element (like div) with overflow-x:auto around the table element:
First Name
Last Name
Points
Points
Points
Points
Points
Points
Points
Points
Points
Points
Jill
Smith
50
50
50
50
50
50
50
50
50
50
Eve
Jackson
94
94
94
94
94
94
94
94
94
94
Adam
Johnson
67
67
67
67
67
67
67
67
67
67
مثال عن جدول بورصة:
Company
Contact
Country
Alfreds Futterkiste
Maria Anders
Germany
Berglunds snabbköp
Christina Berglund
Sweden
Centro comercial Moctezuma
Francisco Chang
Mexico
Ernst Handel
Roland Mendel
Austria
Island Trading
Helen Bennett
UK
Königlich Essen
Philip Cramer
Germany
Laughing Bacchus Winecellars
Yoshi Tannamuri
Canada
Magazzini Alimentari Riuniti
Giovanni Rovelli
Italy
North/South
Simon Crowther
UK
Paris spécialités
Marie Bertrand
France
مثال عن اخفاء/اظهار عنصر:
This is a visible heading
This is a hidden heading
Notice that the hidden heading still takes up space.
مثال عن تغيير طريقة عرض عنصر من بلوك إلى سطري:
These two paragraphs generates inline boxes, and it results in
no distance between the two elements.
مثال عن تغيير طريقة عرض عنصر من سطري إلى بلوك:
A display property with a value of "block" results in a line break between the two elements.
مثال عن تغيير طريقة عرض عنصر باستخدام جافاسكربت:
Click to show panel
This panel contains a div element, which is hidden by default (display: none).
It is styled with CSS and we use JavaScript to show it (display: block).
How it works: Notice that the p element with class="flip" has an onclick attribute attached to it. When the user clicks on the p element, a function called myFunction() is executed, which changes the style of the div with id="panel" from display:none (hidden) to display:block (visible).
You will learn more about JavaScript in our JavaScript Tutorial.
مثال عن تغيير ستايل textarea:
Tip: Use the resize property to prevent textareas from being resized (disable the "grabber" in the bottom right corner):
مثال عن تغيير ستايل input button:
Styled input buttons.
مثال عن input مع ايقونة :
Input with icon:
مثال عن Responsive form:
Responsive Form
Resize the browser window to see the effect. When the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other.
مثال عن تغيير لون عنصر مع animation:
Note: This example does not work in Internet Explorer 9 and earlier versions.
مثال عن تغيير لون وموقع عنصر مع animation:
Note: This example does not work in Internet Explorer 9 and earlier versions.
مثال عن تغيير لون وموقع عنصر مع animation دائم:
Note: This example does not work in Internet Explorer 9 and earlier versions.
تعلم السي أس أس css3
مثال عن Rounded Image:
Rounded Images
Use the border-radius property to create rounded images:
مثال عن Circled Image:
Rounded Images
Use the border-radius property to create circled images:
مثال عن Thumbnail Image:
Thumbnail Images
Use the border property to create thumbnail images:
مثال عن Responsive Image:
Responsive Images
Responsive images will automatically adjust to fit the size of the screen.
Resize the browser window to see the effect:
مثال عن Advanced Image:
Image Modal
In this example, we use CSS to create a modal (dialog box) that is hidden by default.
We use JavaScript to trigger the modal and to display the current image inside the modal when it is clicked on. Also note that we use the value from the image's "alt" attribute as an image caption text inside the modal.
Don't worry if you do not understand the code right away. When you are done with CSS, go to our JavaScript Tutorial to learn more.
×