Search
 
SCRIPT & CODE EXAMPLE
 

HTML

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
Html :: What is the browser default background color for selected text 
Html :: how to make a distance between a label and input html 
Html :: ayoaduwo 
Html :: bootstrap button link 
Html :: hide html element show on print bootstrap 4.6 
Html :: redirect html 
Html :: html quote code 
Html :: marquee tag in html 
Html :: add link behind a button in html 
Html :: tailwind hover color 
Html :: how to embed python in html 
Html :: excel timestamp to date 
Html :: vuetify v-text-field bottom padding 
Html :: chrome remove autocomplete highlight 
Html :: top bar html 
Html :: basic html webpage 
Html :: page html exemple 
Html :: card button align bottom bootstrap 
Html :: html input radio group 
Html :: how to increase width of textbox in html 
Html :: new line html 
Html :: how to parse html data using beautifulsoup 
Html :: how to fix input field and disabled 
Html :: html align text left 
Html :: chrome responsive mode not working 
Html :: ngForm 
Html :: sudo: /opt/lampp/lampp: command not found 
Html :: install php windows 10 
Html :: website code example for html 
Html :: how to center vertically in bootstrap col 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =