How to Create Pure CSS Scrolling Text Animation Effects?

In this blog, I am creating Scrolling Text Animation Effects with HTML & CSS. So, let’s Create an index.html & style.css page so, below an index.html page content-

Below style.css file, in this file, i am using multiple CSS class & id which is used in index.html.

Tagged : / / / / / / /

How To Create Hexagon Using HTML and CSS with different shape Source code?

In this tutorial, I am using HTML & CSS and create a Hexagon shape in an easy way. So, before I am creating an HTML & CSS file with “.html” & “.css” extension. as below-

In this “index.html” page I am using a “class” with “hexagon” and after that hexagon class using below “style.css” page which is mention below-

This is hexagon shape. Here, I am using three different color but if you want to change then you can change as your wish.

If you want to create a different shape then Click Here and create a different- different shap as you wish. as below step-

When you will be open link then shown below page with left side show shape list-

After that click any shape and shown below “css” code –

So, Copy this code and paste in your css section as below-
After that create your shape below-
Tagged : / /

How to create a Responsive Navigation Bar with HTML CSS and Javascript?

In this tutorial, I am using HTMO, CSS, and Javascript and create a Responsive Navigation Bar. So, first create page with “.html” extension and write code as below-

And Below CSS code which is using in this navigation bar-

After that complete a Responsive Navigation bar as below –

When using a cursor on navbar link then uses “:hover” css function
In this Mobile showing as view responsive with “toggle” fa fa icon
When Click “toggle” fa fa-icon then show this type of navigation bar.
Tagged : / / / /

How to use different types of Media Features in CSS?

  • any-hover – Does any available input mechanism allow the user to hover over elements? (added in Media Queries Level 4)
  • any-pointer – Is any available input mechanism a pointing device, and if so, how accurate is it? (added in Media Queries Level 4)
  • aspect-ratio – The ratio between the width and the height of the viewport
  • color – The number of bits per color component for the output device
  • color-index – The number of colors the device can display
  • grid – Whether the device is a grid or bitmap
  • height – The viewport height
  • hover – Does the primary input mechanism allow the user to hover over elements? (added in Media Queries Level 4)
  • inverted-colors – Is the browser or underlying OS inverting colors? (added in Media Queries Level 4)
  • light-level – Current ambient light level (added in Media Queries Level 4)
  • max-aspect-ratio – The maximum ratio between the width and the height of the display area
  • max-color – The maximum number of bits per color component for the output device
  • max-color-index – The maximum number of colors the device can display
  • max-device-aspect-ratio – The maximum ratio between the width and the height of the device
  • max-device-height – The maximum height of the device, such as a computer screen
  • max-device-width – The maximum width of the device, such as a computer screen
  • max-height – The
  • max-monochrome – The maximum number of bits per “color” on a monochrome (greyscale) device
  • max-resolution – The maximum resolution of the device, using dpi or dpcmmaximum height of the display area, such as a browser window
  • scan – The scanning process of the output device
  • scripting – Is scripting (e.g. JavaScript) available? (added in Media Queries Level 4)
  • max-width – The maximum width of the display area, such as a browser window
  • min-aspect-ratio – The minimum ratio between the width and the height of the display area
  • min-color – The minimum number of bits per color component for the output device
  • min-color-index – The minimum number of colors the device can display
  • min-device-aspect-ratio – The minimum ratio between the width and the height of the device
  • min-device-width – The minimum width of the device, such as a computer screen
  • min-device-height – The minimum height of the device, such as a computer screen
  • min-height – The minimum height of the display area, such as a browser window
  • min-monochrome – The minimum number of bits per “color” on a monochrome (greyscale) device
  • min-resolution – The minimum resolution of the device, using dpi or dpcm
  • min-width – The minimum width of the display area, such as a browser window
  • monochrome – The number of bits per “color” on a monochrome (greyscale) device

  • update-frequency – How quickly can the output device modify the appearance of the content (added in Media Queries Level 4)
  • width – The viewport width
  • orientation – The orientation of the viewport (landscape or portrait mode)
  • overflow-block – How does the output device handle content that overflows the viewport along the block axis (added in Media Queries Level 4)
  • overflow-inline – Can content that overflows the viewport along the inline axis be scrolled (added in Media Queries Level 4)
  • pointer – Is the primary input mechanism a pointing device, and if so, how accurate is it? (added in Media Queries Level 4)
  • resolution – The resolution of the output device, using dpi or dpcm
Tagged : / / / / / / / / /

How to use Media Query in CSS for a responsive webpage?

A media query consists of an optional media type and zero or more expressions that limit the style sheets’ scope by using media features, such as width, height, and color.

Syntax: –

@media not|only mediatype and (expressions/ media features) {   CSS;  }

Ex: –

@media screen and (min-width: 480px) {

    body {

        background-color: lightgreen;    }

}

@media (min-width: 480px) {

    body {

        background-color: lightgreen;    }

}

  • all – Used for all media type devices
  • print – Used for printers
  • screen – Used for computer screens, tablets, smart-phones etc.
  • speech – Used for screenreaders that “reads” the page out loud

If you use the not or only operators, you must specify an explicit media type.

And-

  • @media (min-width: 800px) { CSS }
  • @media (min-width: 800px) and (orientation: landscape) { CSS }
  • @media screen and (min-width: 800px) and (orientation: landscape) { CSS }

Or (Comma , )-

  • @media (min-width: 800px), (orientation: landscape) { CSS }

Not-

  • @media not all and (min-width: 800px) { CSS }
  • @media not (all and (min-width: 800px)) { CSS }
  • @media (not all) and (min-width: 800px) { CSS }
  • @media not screen and (color), print and (color) { CSS }
  • @media (not (screen and (color))), print and (color) { CSS }
Tagged : / / / /

How to use perspective property in CSS?

This property is used to define how many pixels a 3D element is placed from the view. This property allows you to change the perspective on how 3D elements are viewed. This will only effect on 3D transformed elements.

Whenever we define the perspective property for an element, it is the child elements that get the perspective view, not the element itself.

We can set this property to none (default) and length

Ex: –

div { perspective: 50px ; }

Perspective-origin

This property is used to define where a 3D element is based in the x- and the y-axis. This property allows you to change the bottom position of 3D elements. This will only effect on 3D transformed elements. We can set this property to x (default 50%) and y axis (default 50%).

Whenever we define the perspective-origin property for an element, it is the child elements that are positioned, not the element itself.

 Ex: –

div { perspective-origin: 20%   20%  ; }

backface-visibility

This property is used to define whether or not an element should be visible when not facing the screen. This property is useful when an element is rotated, and you do not want to see its backside. We can set this property to visible (default) and hidden.

Ex: –

div { backface-visibility: hidden; }

Tagged : / / / /

How to use transform-origin property in CSS?

This property is used to change the position of transformed elements. This property must be used together with the transform property. We can set this property to x, y and z axis.

2D transformations can change the x and y axis of an element.

3D transformations can change the x, y and z axis of an element.

Syntax: –

Selector { transform-origin: x-axis y-axis z-axis; }

Ex: –

div { transform-origin: 10%   20%    30%  ; }

x-axis

This is used to define where the view is placed at the x-axis.

  • left
  • center
  • right
  • length (px, cm, em, %)

y-axis-

This is used to define where the view is placed at the y-axis.

  • top
  • center
  • bottom
  • length (px, cm, em, %)

z-axis-

This is used to define where the view is placed at the z-axis.

  • length (px, cm, em, %)

transform-style-

This property is used to specify how nested elements are rendered in 3D space. This property must be used together with the transform property. We can set this property to flat (default) and preserve-3d.

Ex: –

div { transform-style: preserve-3d ; }

Note – child elements will preserve its 3D position

Tagged : / / / / / /

How to use 3d transform property in CSS?

This property is used to apply a 2D or 3D transformation to an element. We can set below values: –

  • translate()
  • rotate()
  • scale()
  • skew()
  • matrix()
  • translate3d()
  • rotate3d()
  • scale3d()
  • matrix3d()
  • perspective()

3D Transform

  • transform
  • transform-origin
  • transform-style
  • perspective
  • perspective-origin
  • backface-visibility

translate3d( )

Syntax: –

transform: translateX(px)
transform: translateY(px)
transform: translateZ(px)
transform: translate3d(Xpx, Ypx, Zpx)

Ex: –

transform: translateX(10px)
transform: translateY(5px)
transform: translate3d(10px, 5px, 20px)

rotate3d( )

Syntax: –

transform: rotateX(deg)
transform: rotateY(deg)
transform: rotateZ(deg)
transform: rotate3d(Xdeg, Ydeg, Zdeg, Angledeg)

Ex: –

transform: rotateX(50deg)
transform: rotateY(40deg)
transform: rotateZ(20deg)
transform: rotate3d(50deg, 50deg, 50deg, 60deg)

scale3d( )

Syntax: –

transform: scaleX(x)
transform: scaleY(y)
transform: scaleZ(z)
transform: scale3d(x, y, z)

Ex:-

transform: scaleX(3)
transform: scaleY(4)
transform: scaleZ(5)
transform: scale3d(3, 4, 5)

matrix()

Syntax: –

transform: matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n)

Ex:-

transform:

Tagged : / / / / / / / / /

How to use 2d transform property in CSS?

This property is used to apply a 2D or 3D transformation to an element. We can set below values: –

  • translate()
  • rotate()
  • scale()
  • skew()
  • matrix()

Ex:-

div { transform: rotate(20deg); }

translate( )

This method is used to move an element from its current position.

Syntax: –

transform: translateX(px)

transform: translateY(px)

transform: translate(Xpx, Ypx)

Ex: –

transform: translateX(10px)

transform: translateY(5px)

transform: translate(10px, 5px)

rotate( )

This method is used to rotate an element clockwise or anti-clockwise according to a given degree.

Using negative values will rotate the element anti-clockwise.

Syntax: –

transform: rotate(ndeg)

Ex: –

transform: rotate(50deg)

transform: rotate(-40deg)

scale( )

This method is used to increases or decreases the size of an element

Syntax: –

transform: scaleX(width)
transform: scaleY(height)
transform: scale(width, height)

Ex: –

transform: scaleX(3)
transform: scaleY(4)
transform: scale(3, 4)

skew()

This method is used to skews an element along the X and Y-axis by the given angles.

Syntax: –

transform: skewX(deg)
transform: skewY(deg)
transform: skew(Xdeg, Ydeg)

Ex: –

transform: skewX(30deg)
transform: skewY(40deg)
transform: skew(30deg, 40deg)
transform: skew(30deg)

matrix()

This method is used to combines all the 2D transform methods into one.

The matrix() method take six parameters, containing mathematic functions, which allows you to rotate, scale, move (translate), and skew elements.

The parameters are as follow:

matrix(scaleX(),skewY(),skewX(),scaleY(),translateX(),translateY())

Syntax: –

transform:

Ex: –

transform:

none

No transform

Ex: –

transform: none;

Tagged : / / / / / / / /

How to use display property in CSS?

This property is used to define how an element should display. Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.

display properties use below –

  • inline
  • block
  • flex
  • inline-block
  • inline-flex
  • inline-table
  • list-item
  • run-in
  • table
  • table-row-group
  • table-caption
  • table-column-group
  • table-header-group
  • table-footer-group
  • table-cell
  • table-column
  • table-row none

Display

  • inline – When we set this value, the element does not start on a new line and only takes up as much width as necessary (we can’t set width/height it won’t work)
  • block – When we set this value, element always starts on a new line and takes up the full width available (we can set width/height)
  • inline-block – It is combination of inline and block value. It doesn’t start on new line but we can set width and height.
  • none – The element will not be displayed at all (has no effect on layout)
  • flex – Displays an element as a block-level flex container.
  • inline-flex – Displays an element as an inline-level flex container.
  • inline-table – The element is displayed as an inline-level table
  • run-in – Displays an element as either block or inline, depending on context
  • table – It works like a element
  • table-caption – It works like a element
  • table-header-group – It works like a element
  • table-footer-group – It works like a element
  • table-row-group – It works like a element
  • table-cell – It works like a element
  • table-row – It works like a element
  • list-item – It works like a element

justify-content

This property is used to align the flexible container’s items when the items do not use all available space on the main-axis (horizontally). We can set this property to flex-start (default), flex-end, center, space-between, space-around.

Ex: –

div { justify-content: center; }

  • flex-start – This is used to position the item at the beginning of the container
  • flex-end – This is used to position the item at the end of the container
  • center – This is used to position the item at the center of the container
  • space-between – This is used to position the item with space between the lines
  • space-around – This is used to position the item with space before, between, and after the lines

align-items

This property is used to specify the default alignment for items inside the container. This property can be override using align-self property for each item. We can set this property to stretch (default), center, flex-start, flex-end, baseline.

Ex: –

div { align-items: center; }

  • stretch – This is used to stretch the item to fit the container
  • center – This is used to position the item at the center of the container
  • flex-start – This is used to position the item at the beginning of the container
  • flex-end – This is used to position the item at the end of the container
  • baseline – This is used to position the item at the baseline of the container

align-content

This property is used to modify the behavior of the flex-wrap property. It is similar to align-items, but instead of aligning flex items, it aligns flex lines. There must be multiple lines of items for this property to have any effect. We can set this property to stretch (default), center, flex-start, flex-end, space-between, space-around.

Ex: –

  • div { align-content: center; }
  • stretch – Lines stretch to take up the remaining space
  • center – Lines are packed toward the center of the flex container
  • flex-start – Lines are packed toward the start of the flex container
  • flex-end – Lines are packed toward the end of the flex container
  • space-between – Lines are evenly distributed in the flex container
  • space-around – Lines are evenly distributed in the flex container, with half-size spaces on either end

order

This property is used to specify the order of a flexible item relative to the rest of the flexible items inside the same container. If the element is not a flexible item, the order property has no effect. We can set this property to number (default 0).

Ex:

div {order: 1}

align-self

This property is used to specify the alignment for the selected item inside the flexible container. The align-self property overrides the flexible container’s align-items property. We can set this property to auto (default), stretch, center, flex-start, flex-end, baseline.

Ex:

  • div {align-self: center;}
  • auto – The element inherits its parent container’s align-items property, or “stretch” if it has no parent container
  • stretch – This is used to position the element to fit the container
  • center – This is used to position the element at the center of the container 
  • flex-start – This is used to position the element at the beginning of the container
  • flex-end – This is used to position the element at the end of the container
  • baseline – This is used to position the element at the baseline of the container
Display-block property

Tagged : / / / / / / /