Search
 
SCRIPT & CODE EXAMPLE
 

CSS

how to make a square div in css

.square {
    background-color: #000;
    width: 50vw;
    height: 50vw;
}
.square h1 {
    color: #fff;
}
/* It works */
Comment

square div

<div class='square-box'>
    <div class='square-content'>
        <h3>test</h3>
    </div>
</div>

<style>
.square-box{
    position: relative;
    width: 50%; /* You need to specify some width */
    overflow: hidden;
    background: rgba(0,0,0,0.1);
}
.square-box:before{
    content: "";
    display: block;
    padding-top: 100%;
}
.square-content{
    position:  absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    text-align: center;
    width: 100%;
}
</style>
Comment

PREVIOUS NEXT
Code Example
Css :: font-weight css 
Css :: remove underline from <a HTML 
Css :: scss watch command 
Css :: css media two conditions 
Css :: how to define max number of character for a paragraph css 
Css :: rust get current date 
Css :: css root variables 
Css :: ::-ms-clear 
Css :: remove border from last child css 
Css :: autofit grid css 
Css :: background-image linear gradient and border radius 
Css :: cemter absolute elemetn 
Css :: input start typing in the center 
Css :: import maxcdn.bootstrapcdn.com not in index.html in specific component file 
Css :: how to check if eloquent result is empty 
Css :: change color to white svg with filter 
Css :: blue color when button click web mobile 
Css :: how to align text verticaly 
Css :: div not larger than its content 
Css :: line under text css 
Css :: remove accordion space materuail ui css 
Css :: background color for whole page css 
Css :: css thinner hr 
Css :: css units 
Css :: z pos css 
Css :: cursive css 
Css :: vertical align span tailwindscss 
Css :: line in middle word css 
Css :: onhover mouse pointer css 
Css :: kerning css 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =