Workspace
  • Study Book
  • WEB Network HTTP etc
    • Performance Optimization
    • Performance Optimization
    • HTTP/2 & SPDY
    • WebSocket
    • HTTP Header
    • Cross-Origin Resource Sharing
    • JSON, XML, other format
  • Javascript
    • Promise
    • make API call
    • Web API
    • Common JS
    • AJAX
    • Event DOM and delegation
    • ES6 new features
    • special function
    • function API
  • React
    • class component
    • Example
    • Lifting functions/ state up
    • Hot Loader
    • Testing
    • New Features
    • Hook
    • Simple code
    • Life Cycle
  • CSS
    • Horizontal & Vertical Align
    • GPU Animation
    • transform-function
    • LVHA Pseudo-classes
    • Selector
    • How To CSS
  • HTML
  • Redux
  • NodeJS
    • File System
  • express
    • express questions
    • express mongodb
  • Restful API
  • MongoDB
  • Compare
  • Test
    • Jest
  • Deploy development
  • coding question
  • DevOps
  • Webpack
  • GraphQL
Powered by GitBook
On this page
  • make element in the center both position
  • Make multiply divs in a line.
  • Hoverable Dropdown
  • CSS Layout - Horizontal & Vertical Align

Was this helpful?

  1. CSS

How To CSS

About how to

PreviousSelectorNextHTML

Last updated 4 years ago

Was this helpful?

make element in the center both position

2 div, outer, inner

  1. use position transform

Make multiply divs in a line.

3. methods

left

flex

Hoverable Dropdown

Move the mouse over the button to open the dropdown menu.

Dropdown Link 1 Link 2 Link 3

.dropdown-content a:hover {background-color: #ddd;}

.dropdown:hover .dropdown-content {display: block;}

.dropdown:hover .dropbtn {background-color: #3e8e41;}

CSS Layout - Horizontal & Vertical Align

https://www.w3schools.com/css/css_align.asp

Center Align Elements

.To horizontally center a block element (like <div>), use margin: auto;

center { margin: auto; width: 50%; }

Center Align Text

.center { text-align: center; }

Center an Image

img { display: block; margin-left: auto; margin-right: auto; width: 40%; }

Left and Right Align - Using position

.right { position: absolute; right: 0px; width: 300px; border: 3px solid #73AD21; padding: 10px; }

Left and Right Align - Using float

.right { float: right; width: 300px; border: 3px solid #73AD21; padding: 10px; }

W3Schools online HTML editor
Logo
<div class="outer"> <div class="inner"> </div> </div>