JUAN DE LA CRUZ 1234 Taal Street, Singalong 23 Maisan Road Malate, Manila 1004 Malinta, Valenzuaela City ( 02 ) 123 4567 ; 123 4567 ( 02 ) 765 4321 +63 9171234567 juandelacruz@yahoo.com w3schools.com THE WORLD'S LARGEST WEB DEVELOPER SITE HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP HOW TO MORE EXERCISES REFERENCES CSS Tutorial CSS HOME CSS Introduction CSS Syntax CSS How To CSS Colors CSS Backgrounds CSS Borders CSS Margins CSS Padding CSS Height/Width CSS Box Model CSS Outline CSS Text CSS Fonts CSS Icons CSS Links CSS Lists CSS Tables CSS Display CSS Max-width CSS Position CSS Overflow CSS Float CSS Inline-block CSS Align CSS Combinators CSS Pseudo-class CSS Pseudo-element CSS Opacity CSS Navigation Bar CSS Dropdowns CSS Image Gallery CSS Image Sprites CSS Attr Selectors CSS Forms CSS Counters CSS Website Layout CSS Units CSS Specificity CSS Advanced CSS Rounded Corners CSS Border Images CSS Backgrounds CSS Colors CSS Gradients CSS Shadows CSS Text Effects CSS Web Fonts CSS 2D Transforms CSS 3D Transforms CSS Transitions CSS Animations CSS Tooltips CSS Style Images CSS object-fit CSS Buttons CSS Pagination CSS Multiple Columns CSS User Interface CSS Variables CSS Box Sizing CSS Flexbox CSS Media Queries CSS MQ Examples CSS Responsive RWD Intro RWD Viewport RWD Grid View RWD Media Queries RWD Images RWD Videos RWD Frameworks RWD Templates CSS Grid Grid Intro Grid Container Grid Item CSS Examples CSS Templates CSS Examples CSS Quiz CSS Exercises CSS Certificate CSS References CSS Reference CSS Selectors CSS Functions CSS Reference Aural CSS Web Safe Fonts CSS Animatable CSS Units CSS PX-EM Converter CSS Colors CSS Color Values CSS Default Values CSS Browser Support CSS Examples ‹ Previous Next › CSS Syntax The element selector The id selector The class selector (for all elements) The class selector (for only <p> elements) Grouping selectors CSS comments CSS syntax explained CSS Colors Set the background color of an element Set the text color Set the border color Set different color values Set RGB values Set HEX values Set HSL values CSS colors explained CSS Backgrounds Set the background color of a page Set the background color of different elements Set an image as the background of a page How to repeat a background image only horizontally How to position a background image A fixed background image (this image will not scroll with the rest of the page) All the background properties in one declaration Advanced background example Background properties explained CSS Borders Set the width of the four borders Set the width of the top border Set the width of the bottom border Set the width of the left border Set the width of the right border Set the style of the four borders Set the style of the top border Set the style of the bottom border Set the style of the left border Set the style of the right border Set the color of the four borders Set the color of the top border Set the color of the bottom border Set the color of the left border Set the color of the right border All the border properties in one declaration Add rounded borders to an element Set different borders on each side All the top border properties in one declaration All the bottom border properties in one declaration All the left border properties in one declaration All the right border properties in one declaration Border properties explained CSS Margins Specify different margins for each side of an element Use shorthand margin property with four values Use shorthand margin property with three values Use shorthand margin property with two values Use shorthand margin property with one value Set margin to auto to center the element within its container Let the left margin be inherited from the parent element Margin collapse Margin properties explained CSS Padding Specify different padding for each side of an element Use shorthand padding property with four values Use shorthand padding property with three values Use shorthand padding property with two values Use shorthand padding property with one value Padding and element width (without box-sizing) Padding and element width (with box-sizing) Set padding-left of an element Set padding-right of an element Set padding-top of an element Set padding-bottom of an element Padding properties explained CSS Height/Width Set the height and width of an element Set max-width of an element Set the height and width of different elements Set the height and width of an image using percent Set min-width and max-width of an element Set min-height and max-height of an element Dimension properties explained CSS Box Model Demonstrating the box model Specify an element with a total width of 250px Box model explained CSS Outline Draw a line around an element (outline) Set the style of an outline Set the color of an outline Use outline-color: invert on an outline Set the width of an outline Use the shorthand outline property Add space between an outline and the edge/border of an element Outline properties explained CSS Text Set the text color of different elements Align the text Remove the line under links Decorate the text Control the letters in a text Indent text Specify the space between characters Specify the space between lines Set the text direction of an element Increase the white space between words Specify a text shadow for an element Disable text wrapping inside an element Vertical alignment of an image inside text Text properties explained CSS Fonts Set Set Set Set Set Set Set the the the the the the the font of a text size of the font size of the font in px size of the font in em size of the font in percent and em style of the font variant of the font Set the boldness of the font All the font properties in one declaration Font properties explained CSS Icons Font Awesome icons Bootstrap icons Google icons Icons explained CSS Links Add different colors to visited/unvisited links Use of text-decoration on links Specify a background color for links Add other styles to hyperlinks Different types of cursors Advanced - Create link boxes Advanced - Create link boxes with borders Link properties explained CSS Lists All the different list item markers in lists Set an image as the list-item marker Position the list-item marker Remove default list settings All list properties in one declaration Style lists with colors Full-width bordered list List properties explained CSS Tables Specify a black border for table, th, and td elements Use of border-collapse Single border around the table Specify the width and height of a table Set the horizontal alignment of content (text-align) Set the vertical alignment of content (vertical-align) Specify the padding for th and td elements Horizontal dividers Hoverable table Striped tables Specify the color of the table borders Set the position of the table caption Responsive Table Create a fancy table Table properties explained CSS Display How to hide an element (visibility:hidden) How to not display an element (display:none) How to display a block-level element as an inline element How to display an inline element as a block-level element How to to use CSS together with JavaScript to show hidden content Display properties explained CSS Positioning Position an element relative to the browser window Position an element relative to its normal position Position an element with an absolute value Sticky positioning Overlapping elements Set the shape of an element Set the top edge of an image using a pixel value Set the bottom edge of an image using a pixel value Set the left edge of an image using a pixel value Set the right edge of an image using a pixel value Position image text (top left corner) Position image text (top right corner) Position image text (bottom left corner) Position image text (bottom right corner) Position image text (centered) Positioning properties explained CSS Overflow Using overflow: visible - The overflow is not clipped. It renders outside the element's box. Using overflow: hidden - The overflow is clipped, and the rest of the content is hidden. Using overflow: scroll - The overflow is clipped, but a scrollbar is added to see the rest of the content. Using overflow: auto - If overflow is clipped, a scrollbar should be added to see the rest of the content. Using overflow-x and overflow-y. Overflow properties explained CSS Floating A simple use of the float property An image with border and margins that floats to the right in a paragraph An image with a caption that floats to the right Let the first letter of a paragraph float to the left Turning off float (using the clear property) Turning off float (using the "clearfix" hack) Create floating boxes Create side-by-side images Create equal-height boxes (with flexbox) Creating a horizontal menu Create a web layout example Float properties explained CSS Inline-block Show the differences between inline, inline-block and block Using inline-block to create navigation links Inline-block explained CSS Aligning Elements Center aligning with margin Center aligning text Center an image Left/Right aligning with position Left/Right aligning with position - Crossbrowser solution Left/Right aligning with float Left/Right aligning with float - Crossbrowser solution Center vertically with padding Center vertically and horizontally Center vertically with line-height Center vertically and horizontally with position Align properties explained CSS Combinators Descendant selector Child selector Adjacent Sibling selector General Sibling selector Combinator selectors explained CSS Pseudo-classes Add different colors to a hyperlink Add other styles to hyperlinks Use of :focus :first-child - match the first p element :first-child - match the first i element in all p elements :first-child - Match all i elements in all first child p elements Use of :lang Pseudo-classes explained CSS Pseudo-elements Make the first letter special in a text Make the first line special in a text Make the first letter and first line special Use :before to insert some content before an element Use :after to insert some content after an element Pseudo-elements explained CSS Generated Content Insert the URL in parenthesis after each link with the content property Numbering sections and sub-sections with "Section 1", "1.1", "1.2", etc. Specify the quotation marks with the quotes property CSS Counters explained CSS Opacity Creating transparent images Creating transparent images - mouseover effect Reversed mouseover effect for transparent images Transparent box/div Transparent box/div with RGBA values Creating a transparent box with text on a background image Image opacity explained CSS Navigation Bars Fully styled vertical navigation bar Fully styled horizontal navigation bar Full-height fixed vertical navigation bar Fixed horizontal navigation bar Sticky navigation bar (does not work in IE or Edge 15 and earlier) Responsive top navigation Responsive side navigation Navigation bars explained CSS Dropdowns Dropdown text Dropdown menu Right-aligned dropdown menu Dropdown image Dropdown navigation bar Dropdowns explained CSS Image Gallery Image gallery Responsive Image gallery Image gallery explained CSS Image Sprites An image sprite An image sprite - a navigation list An image sprite with hover effect Image sprites explained CSS Attribute Selectors Selects all <a> elements with a target attribute Selects all <a> elements with a target="_blank" attribute Selects all elements with a title attribute that contains a space-separated list of words, one of which is "flower" Selects all elements with a class attribute value that begins with "top" (must be whole word) Selects all elements with a class attribute value that begins with "top" (must not be whole word) Selects all elements with a class attribute value that ends with "test" Selects all elements with a class attribute value that contains "te" Attribute selectors explained CSS Forms Full-width input field Padded input field Bordered input field Bottom bordered input field Colored input fields Focused input fields Focused input fields 2 Input with icon/image Animated search input Styling textareas Styling select menus Styling input buttons Responsive form Forms explained CSS Counters Create a counter Nested counters 1 Nested counters 2 Counters explained CSS Website Layout Simple, responsive website layout A website example Website Layout explained CSS Rounded Corners Add rounded corners to elements Round each corner separately Create elliptical corners CSS rounded corners explained CSS Border Images Create an image border around an element, using the round keyword Create an image border around an element, using the stretch keyword Image border - Different slice values CSS border images explained CSS Backgrounds Add multiple background images for an element Specify the size of a background image Scale a background image using "contain" and "cover" Define sizes of multiple background images Full-size background image (completely fill the content area) Use background-origin to specify where the background image is positioned Use background-clip to specify the painting area of the background CSS backgrounds explained CSS Gradients Linear Gradient - top to bottom Linear Gradient - left to right Linear Gradient - diagonal Linear Gradient - with a specified angle Linear Gradient - with multiple color stops Linear Gradient - color of a rainbow + text Linear Gradient - with transparency Linear Gradient - a repeating linear gradient Radial Gradient - evenly spaced color stops Radial Gradient - differently spaced color stops Radial Gradient - set shape Radial Gradient - different size keywords Radial Gradient - a repeating radial gradient CSS gradients explained CSS Shadow Effects Simple shadow effect Add a color to the shadow Add a blur effect to the shadow White text with black shadow A red neon glow shadow A red and blue neon glow shadow White text with black, blue, and darkblue shadow Add a simple box-shadow to an element Add color to box-shadow Add color and blur effect to box-shadow Create paper-like cards (text) Create paper-like cards (polaroid images) CSS shadow effects explained CSS Text Effects Specify how hidden, overflowed content should be signaled to the user How to display the overflowed content when hover over the element Allow long words to be able to be broken and wrap onto the next line Specify line breaking rules CSS text explained CSS Web Fonts Use your "own" fonts in @font-face rule Use your "own" fonts in @font-face rule (bold) CSS web fonts explained CSS 2D Transforms translate() - move an element from its current position rotate() - rotate an element clockwise rotate() - rotate an element counter-clockwise scale() - increase an element scale() - decrease an element skewX() - skews an element along the X-axis skewY() - skews an element along the Y-axis skew() - skews an element along the X and Y-axis matrix() - rotate, scale, move, and skew an element CSS 2D transforms explained CSS 3D Transforms rotateX() - rotate an element around its X-axis at a given degree rotateY() - rotate an element around its Y-axis at a given degree rotateZ() - rotate an element around its Z-axis at a given degree CSS 3D transforms explained CSS Transitions Transition - change width of an element Transition - change width and height of an element Specify different speed curves for a transition Specify a delay for a transition effect Add a transformation to a transition effect Specify all transition properties in one shorthand property CSS transitions explained CSS Animations Bind an animation to an element Animation - change background-color of an element Animation - change background-color and position of an element Delay an animation Run animation 3 times before it stops Run animation for ever Run animation in reverse direction Run animation in alternate cycles Speed curves for animations Animation shorthand property CSS animations explained CSS Tooltips Right tooltip Left tooltip Top tooltip Bottom tooltip Tooltip with arrow Animated tooltip Tooltips explained CSS Style Images Rounded image Circled image Thumbnail image Thumbnail image as link Responsive image Image text (top left corner) Image text (top right corner) Image text (bottom left corner) Image text (bottom right corner) Image text (centered) Polaroid images Grayscale image filter Advanced - Image Modal with CSS and JavaScript CSS Images explained CSS Object-fit Cut off the sides of an image, preveserving the aspect ratio, and fill in the space An example of all object-fit property values Object-fit explained CSS Buttons Basic CSS buttons Button colors Button sizes Rounded buttons Colored button borders Hoverable buttons Shadow buttons Disabled buttons Button width Button groups Bordered button group Animated Button (Hover Effect) Animated Button (Ripple Effect) Animated Button (Pressed Effect) CSS buttons explained CSS Pagination Simple pagination Active and hoverable pagination Rounded active and hoverable pagination Hoverable transition effect Bordered pagination Rounded bordered pagination Pagination with space between links Pagination size Pagination with space between links Centered pagination Breadcrumbs CSS pagination explained CSS Multiple Columns Create multiple columns Specify the gap between columns Specify the style of the rule between columns Specify the width of the rule between columns Specify the color of the rule between columns Specify the width, style and color of the rule between columns Specify how many columns an element should span across Specify a suggested, optimal width for the columns CSS multiple columns explained CSS User Interface Let a user resize the width of an element Let a user resize the height of an element Let a user resize both the width and height of an element Add space between an outline and the border of an element CSS user interface explained CSS Variables Using the var() function Using the var() function to insert several custom property values CSS variables explained CSS Box Sizing Width of elements without box-sizing Width of elements with box-sizing Form elements + box-sizing CSS box sizing explained CSS Flexbox Flexbox with three flex items Flexbox with three flex items - rtl direction flex-direction - row-reverse flex-direction - column flex-direction - column-reverse justify-content - flex-end justify-content - center justify-content - space-between justify-content - space-around align-items - stretch align-items - flex-start align-items - flex-end align-items - center align-items - baseline flex-wrap - nowrap flex-wrap - wrap flex-wrap - wrap-reverse align-content - center Order the flex items Margin-right:auto; Margin:auto; = perfect centering align-self on flex items Specify the length of the flex item, relative to the rest of the flex items Create a responsive image gallery with flexbox Create a responsive website with flexbox CSS flexbox explained CSS Media Queries Change the background-color to lightgreen if the viewport is 480px wide or wider Show a menu that will float to the left of the page if the viewport is 480px wide or wider CSS media queries explained CSS Media Queries - More Examples Set different background colors depending on screen width Responsive navigation menu Responsive columns using float Responsive columns using flexbox Hide elements with media queries Responsive font size Responsive image gallery Responsive website Change layout of a page depending on the orientation of the browser Min width to max width CSS media queries examples explained CSS Responsive Webdesign Responsive grid view Add breakpoints for desktops, laptops and phones Typical breakpoints Responsive image Responsive video Responsive framework: W3.CSS Responsive framework: Bootstrap CSS responsive webdesign explained CSS Grid Grid Grid Grid Grid Grid Grid CSS layout elements column gaps lines container items grid explained ‹ Previous Next › COLOR PICKER HOW TO Tabs Dropdowns Accordions Side Navigation Top Navigation Modal Boxes Progress Bars Parallax Login Form HTML Includes Google Maps Range Sliders Tooltips Slideshow Filter List Sort List SHARE CERTIFICATES HTML CSS JavaScript PHP jQuery Bootstrap XML Read More » REPORT ERROR PRINT PAGE FORUM ABOUT Top Tutorials HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial W3.CSS Tutorial Bootstrap Tutorial SQL Tutorial PHP 5 Tutorial PHP 7 Tutorial jQuery Tutorial Python Tutorial Top References HTML Reference CSS Reference JavaScript Reference W3.CSS Reference Bootstrap Reference SQL Reference PHP Reference HTML Colors jQuery Reference Python Reference Angular Reference Top Examples HTML Examples CSS Examples JavaScript Examples How To Examples W3.CSS Examples Bootstrap Examples PHP Examples Python Examples jQuery Examples Java Examples XML Examples Web Certificates HTML Certificate CSS Certificate JavaScript Certificate jQuery Certificate PHP Certificate Bootstrap Certificate XML Certificate W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 1999-2019 by Refsnes Data. All Rights Reserved. Powered by W3.CSS.