To create a responsive html signature, I tried the infamous <style scoped> tag. As far as I understood there's a conflict with #media queries. Is there a better way to achieve this in a way I can use it in MS Outlook client, preferably both on PC and smartphone?
Here's a reduced version of what I have:
<style scoped>
#containter {
width: 100%;
height: 250px;
}
#firm-contact {
width: 35%;
float: left;
}
#firm-links {
width: 290px;
float: left;
}
#firm-logo {
margin: 2% 4% 1% 4%;
width: 165px;
float: left;
}
/* screenwitdh <= 980px */
#media screen and (max-width: 980px) {
#containter {
height: 580px;
}
#firm-contact {
width: 41%;
}
#firm-links {
width: 41%;
float: right;
}
#firm-logo {
clear: both;
width: auto;
float: none;
}
}
/* screenwitdh <= 600px */
#media screen and (max-width: 600px) {
#containter {
height: 680px;
}
...
}
</style>
<div id="footer">
<div id="display">
<div id="containter">
<div id="firm-contact">
<p>Streer</p>
<p>Place</p>
<p>+tel</p>
</div>
<div id="firm-links">
<p><span>Links</span><</p>
<p><Something</p>
<p>Other</p>
</div>
<div id="firm-logo">
<div width="250" heigth="250">
<img class="img-fluid" src="img/some.png" alt="Logo" width="75%">
</div>
</div>
</div> <!-- containter -->
</div> <!-- display -->
</div> <!-- footer -->
Related
I have this html and css layout. I want to make it when reaching tablet with media query and phone to show like in those 2 images. So I have in normal (desktop mode) 4 products all of them in the same line. When the view reaches tablet - 1199 pixels I want those 4 products to be each 2 on a separate line, so 2 lines with 2 products. On the phone mode 768 pixels I want each product to be on its line with the width full like the wrapper.
Here is the code :
body {
margin: 0px;
padding: 0px;
}
/* Header */
.header {
background-color: yellow;
width: 100%;
margin: 0 auto;
}
.wrapper {
max-width: 1200px;
margin: 0 auto;
}
.logo {
background-color: grey;
width: 150px;
height: 50px;
margin-top: 20px;
float: left;
}
.info {
background-color: grey;
width: 285px;
height: 50px;
margin-top: 20px;
float: right;
}
.clear {
clear: both;
}
.menu {
background-color: grey;
width: 1200px;
height: 50px;
margin-top: 20px;
}
/* */
/* Nav-Bar */
.nav-bar {
background-color: lightgray;
width: 1200px;
height: 340px;
margin-top: 20px;
}
/* */
/* Product grid */
.product1,
.product2,
.product3 {
background-color: lightgray;
width: 285px;
height: 320px;
margin-top: 20px;
margin-right: 20px;
float: left;
}
.product4 {
background-color: lightgray;
width: 285px;
height: 320px;
margin-top: 20px;
float: left;
}
/* */
/* Bottom Part */
.content-area {
background-color: lightgray;
width: 100%;
height: 420px;
margin-top: 20px;
}
/* */
/* Footer */
.footer-area {
background-color: gray;
width: 100%;
height: 50px;
margin-top: 20px;
}
/* */
/* Responsive */
#media screen and (max-width: 1199px) {
.product1,
.product2,
.product3,
.product4 {
display: none;
}
}
<!DOCTYPE html>
<html>
<head>
<title>Home View</title>
<link rel="stylesheet" type="text/css" href="../style/homestyle.css">
</head>
<body>
<!-- Header -->
<div class="header">
<div class="wrapper">
<div class="logo"></div>
<div class="info"></div>
<div class="clear"></div>
<div class="menu"></div>
</div>
</div>
<!-- -->
<!-- NavBar -->
<div class="header">
<div class="wrapper">
<div class="nav-bar"></div>
<div class="clear"></div>
</div>
</div>
<!-- -->
<!-- Product Grid -->
<div class="wrapper">
<div class="def1">
<div class="product1"></div>
</div>
<div class="def2">
<div class="product2"></div>
</div>
<div class="def3">
<div class="product3"></div>
</div>
<div class="def4">
<div class="product4"></div>
</div>
<div class="clear"></div>
</div>
<!-- -->
<!-- Bottom Part -->
<div class="wrapper">
<div class="content-area"></div>
</div>
<!-- Footer -->
<div class="header">
<div class="wrapper">
<div class="footer-area"></div>
</div>
</div>
</body>
</html>
The CSSTablet :
I attached the images needed for the layout. Please help!
First you add the view port element to Head of the HTML page.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Ref. link - https://www.w3schools.com/css/css_rwd_viewport.asp
Then Remove fixed width's from .menu and .nav-bar classes and add as max-width.
.menu {
background-color: grey;
max-width: 1200px;
height: 50px;
margin-top: 20px;
}
.nav-bar {
background-color: lightgray;
max-width: 1200px;
height: 340px;
margin-top: 20px;
}
And also you need to wrap your "Product slots" using "div".
(I used class called "wrapper-inner")
<!-- Product Grid -->
<div class="wrapper">
<div class="wrapper-inner">
<div class="def1">
<div class="product1"></div>
</div>
<div class="def2">
<div class="product2"></div>
</div>
<div class="def3">
<div class="product3"></div>
</div>
<div class="def4">
<div class="product4"></div>
</div>
<div class="clear"></div>
</div>
</div>
<!-- -->
Then after you can add required CSS media queries.
/* Responsive */
#media all and (max-width: 1199px) {
.wrapper-inner {
margin: 0 -20px;
background: orange;
padding: 0 20px;
}
.def1, .def2, .def3, .def4 {
width: 50%;
padding: 20px;
float: left;
}
.product1, .product2, .product3, .product4 {
width: 100%;
margin: 0 0;
}
}
#media all and (max-width: 768px) {
.def1, .def2, .def3, .def4 {
width: 100%;
padding: 20px;
float: left;
}
}
You are correct in using media queries. In those you can f.e. set the width of your elements like this:
#media screen and (max-width: 1199) {
.product { // you can write .product1, .product2,... but I would suggest creating this new class, as none of those images really need their own css
max-width: 25%; //this will change for tablet and mobile to 50% and 100%
}
}
Now do that for all modes that you want.
Also note that instead of setting a margin-right you could use flexbox with justify-content: space-between in the wrapper; Otherwise you will have to remove those margins for different screen sizes.
I'm creating a landing page using a responsive grid, on a clean template in Wordpress. I can't get my margins or padding to display on the desktop version, and I can't for the life of me figure out what I've done wrong. They display fine on mobile, but no styling a try and apply to the_content will work.
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* SECTIONS */
.section {
clear: both;
padding: 0px;
margin: 0px;
}
/* COLUMN SETUP */
.col {
display: block;
float:left;
margin: 1% 0 1% 2.5%;}
.col:first-child { margin-left: 0; }
/* GROUPING */
.group:before,
.group:after { content:""; display:table; }
.group:after { clear:both;}
.group { zoom:1; /* For IE 6/7 */ }
* {
box-sizing: border-box;
}
.span_12_of_12 {
width: 100%;}
.span_11_of_12 {
width: 91.45%;}
.span_10_of_12 {
width: 82.91%;}
.span_9_of_12 {
width: 74.37%;}
.span_8_of_12 {
width: 65.83%;}
.span_7_of_12 {
width: 57.29%;}
.span_6_of_12 {
width: 48.75%;}
.span_5_of_12 {
width: 40.20%;}
.span_4_of_12 {
width: 31.66%;}
.span_3_of_12 {
width: 23.12%;}
.span_2_of_12 {
width: 14.58%;}
.span_1_of_12 {
width: 6.041%;}
#media only screen and (max-width: 600px) {
.col { margin: 1% 0 1% 0%; }
.span_1_of_12, .span_2_of_12, .span_3_of_12, .span_4_of_12, .span_5_of_12, .span_6_of_12, .span_7_of_12, .span_8_of_12, .span_9_of_12, .span_10_of_12, .span_11_of_12, .span_12_of_12 {
width: 100%;
}}
#content-desktop {
display: inline; }
#content-mobile {
display: none; }
#media only screen and (max-width: 600px) {
#content-desktop {
display: none;}
#content-mobile {
display: inline;}
.content {
padding: 2% 5% 2% 5%; }
#rightform {
padding: 2% 5% 2% 5%;
color: white;
</style>
</head>
The HTML:
<div class="section group">
<div class="content">
<div class="col span_6_of_12">
<div id="content-desktop">
Body Content Here
</div>
<div id="content-mobile">
Mobile Body Content Here
</div>
</div>
</div>
<div id="rightform">
<div class="col span_6_of_12">
<a name="taketest"></a>
Here is a form that's also not getting any padding on desktop.
</div>
<div class="section group">
<div class="col span_6_of_12" id="content-mobile">
<div class="content">
Mobile Body Copy Two
</div>
</div>
<div class="section group">
<div class="col span_3_of_12 ctabox" id="content-mobile">
<a href="#taketest">
<img src="http://polaron.com.au/wp-content/uploads/2017/09/CTA-Small.png" style="margin: 0% 5% 0% 5%; max-height:120px; vertical-align:middle" /> </a>
</div> </div>
At less than 600px, everything works fine. Padding around all the text. But on Desktop? Nothing. It says it's there, but my text from the_content is right up against the edge of the window. If I try set a max-width or margins, that won't work either. What (probably very obvious thing!) am I missing?
Here is a link to the HTML and CSS. https://jsfiddle.net/dvrfc0dk/
Your padding will only shows up until 600px width since it's inside the
#media only screen and (max-width: 600px) {. Either add max-width for other format or place your .content {
padding: 2% 5% 2% 5%; }. outside the #media only screen and (max-width: 600px) {
I want to create a container so that i have a simple layout with a nav bar at the top and a nav bar on the left side which is about 150px. As the screen gets smaller though, i want the left nav to entirely disappear and have the following occur:
1) Replace the 150px (icon + text) nav bar with just an icon nav bar on the left
or 2) remove/hide the nav bar entirely and have a burger bar in the top nav which will expand a vertical menu down. This would be the exact same menu as the one before on the left except it would not be displayed from the top nav rather than the side.
What i've done so fat?
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Awesome Bootstrap 3 Sidebar Navigation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
/* MORE THAN 75 */
body {
background-color: skyBlue;
}
/* LESS THAN 75 */
#media (max-width: 74.9em) {
body {
background-color: pink;
}
}
/* LESS THAN 62 */
#media (max-width: 61.9em) {
body {
background-color: blue;
}
}
/* LESS THAN 48 */
#media (max-width: 47.9em) {
body {
background-color: green;
}
}
/* LESS THAN 34 */
#media (max-width: 33.9em) {
body {
background-color: red;
}
}
.navbar-outer {
width: 600px;
}
.aav {
background-color: black;
color: white;
border-style: solid;
border-color: red;
}
<div class="row">
<div class="col-xs-12 col-md-8">.col-xs-12 .col-md-8</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
<div class="row aav">
<div class="col-xs-6 col-md-2" style="width:100px; border:solid; color:white;">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-10">.col-xs-6 .col-md-4</div>
</div>
I'm trying to create the left nav and the content pane. I'm thinking too much of java i guess because i'm not sure how to go about the implementation. Any feedback is appreciated.
I'm stuck because i don't want the left bar to scale, i want it to be a fixed width until the screen gets too small for it.
This is a complicated question, but the gist of it is that you can set a container (or just set styles on the body element itself) to hold your nav, sidebar, and general content area, and then modify their widths and heights with media queries.
So given your page is 100vw across, for example, your sidebar could be 150px wide as you mentioned, and that would leave 100vw - 150px for the width of the main content area. You'd float them next to each other.
main {
width: 100vw;
}
aside {
float: left;
width: 150px;
}
section {
float: left;
width: calc(100% - 150px);
}
When you want the sidebar to narrow, you can adjust the width of the sidebar and the calc expression for the main content area. (You'd also hide the labels next to your icons.)
#media all and (max-width: 900px) {
aside {
width: 40px;
}
section {
width: calc(100% - 40px);
}
}
When you get to mobile view, your sidebar can simply become 100% width of the screen, and then you'll need additional CSS to change the display of the icons and whatnot.
#media all and (max-width: 600px) {
aside {
width: 100%;
}
section {
width: 100%;
}
}
That's the general principle you'll want to work with, but a lot of the other CSS will probably depend exactly on your site. Below is an example.
main {
width: 100vw;
height: 100vh;
}
nav {
background-color: #5BA1CB;
height: 80px;
}
nav .title {
width: 130px;
height: 60px;
margin-top: 10px;
margin-left: 10px;
background-color: rgba(255, 255, 255, 0.2);
float: left;
}
nav .burger {
float: left;
margin-left: 20px;
height: 100%;
}
nav .burger img {
margin-top: 10px;
}
aside {
background-color: #144360;
width: 150px;
height: calc(100% - 80px);
float: left;
}
aside .icon {
margin-left: 5px;
margin-top: 50px;
}
aside .icon:first-child {
margin-top: 100px;
}
aside .icon span,
aside .icon img {
vertical-align: middle;
display: inline-block;
}
section {
float: left;
width: calc(100% - 150px);
height: 100%;
background-color: #DAEAF4;
}
#media all and (max-width: 900px) and (min-width: 601px) {
aside {
width: 40px;
}
aside .icon span {
display: none;
}
section {
width: calc(100% - 40px);
}
}
#media all and (max-width: 600px) {
aside {
width: 100%;
height: 150px;
}
aside .icon {
float: left;
width: 100px;
}
aside .icon:first-child {
margin-top: 50px;
}
section {
width: 100%;
}
}
<main>
<nav>
<div class="title"><span>Title Area</span></div>
<div class="burger">
<img src="http://placehold.it/60x60?text=BURGER" />
</div>
</nav>
<aside>
<div class="icon">
<img src="http://placehold.it/25x25" />
<span>Label</span>
</div>
<div class="icon">
<img src="http://placehold.it/25x25" />
<span>Label</span>
</div>
<div class="icon">
<img src="http://placehold.it/25x25" />
<span>Label</span>
</div>
</aside>
<section>
<h1>Body</h1>
</section>
</main>
I'm trying to get a div element that is split in half and in one of the halfs, have 4 equal square boxes.
So far I think I have the initial set up but when I try to produce the 4 squares within one of the halfs one overflows past the other leaving both halfs not equal. I hope the code snippet might help
<!DOCTYPE html>
<html>
<head>
<title> Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
border: 0;
background: gray;
min-width: 100%;
}
.container {
min-width: 100%;
margin: 0 auto;
padding: 4px ;
}
[class*="col-"] {
float: left;
padding: 0;
margin: 0;
border: 0;
width:inherit
}
/* GRID SYSTEM */
.row::after {
content: '';
clear: both;
display: block;
}
#media only screen
and (min-width : 300px)
and (max-width : 640px) {
.col { float: left;}
.col { float: left;}
.mobile-not {
display:none;
}
}
#media only screen
and (min-width: 768px) {
.col { float: left;}
.col-6-md { width: 50%; }
}
#media only screen
and (min-width : 1224px) {
.col-1 { width: 8.33%; }
.col-2 { width: 16.66%; }
.col-2-sm {width: inherit; }
.col-3 { width: 25%; }
.col-4 { width: 33.33%; }
.col-5 { width: 41.66%; }
.col-6 { width: 50%; }
.col-6-md {
display:block;
width: inherit;
}
.col-7 { width: 58.33%; }
.col-8 { width: 66.66%; }
.col-9 { width: 75%; }
.col-10 { width: 83.33%; }
.col-11 { width: 91.66%; }
.col-12 { width: 100%; }
}
img {
width: 100%;
}
.text-demo {
background-color: #0099ff;
}
.text-prop {
padding-right: 20px;
color:white;
text-align: right;
width:100%;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-6">
<a href="/search/">
<img src="https://lh3.googleusercontent.com/xVYh_uJU1fipLAg85BABZvd5rmSTCg-lSFkZR78jP9lCNxjVRHF8dcIkRE_sGh7ReMWs0xo0azaV-nnCsZ-BVbPBVEjZuVi6uojDNHaDlohDCNM2hGL02nASyMhhdWH5yZ6ZjKF2di8IC6HCkDS-VZ5UBb4eryKcmtbKvpDRm7q-knmu_C9GQx3CsNjQIkZhpmoI6asAlrs_DkJK2hgLN_n-lXFBhLDEQnnYMWR1iYLa3yePtSPVHSzzKOODpNPQqZM9oVtNRizEIysesic__qzrHW0bSmEANsnhutwK--2Cs4jc96isl0XQdKfsqTHzcG_Nc5g2-gIegFHnDWYxsh-KgqLtizc4VaBB2oe1BhUN98pIblCkSVgr88PNSPzeqdF6Dz1fjxCqbD1uvuhfPlhiDmcrmLFyf9fzqYzQtOFLyZuojLohGjivsMYhUkSdghen7XkkdvJx-6lK9baVw4kHXp7M1ZbufApnT8wb1PPBmA8Y1TqkeRQkIfBnEbX5G6VWRNiq0AIOWwkvJSwxGLlwL7Kuh7p77JbTqyn-0w1ydDq80bmFKtvnvnf2AQEvmuTFdgSiFAMWJbYlb5o8_nnuGvATqmCd57DanPW8mOsrULpfaTHi=w468-h379-no">
</a>
</div>
<div class="col-6">
<div class="col-2-sm">
<a href="/search/">
<img src="https://lh3.googleusercontent.com/xVYh_uJU1fipLAg85BABZvd5rmSTCg-lSFkZR78jP9lCNxjVRHF8dcIkRE_sGh7ReMWs0xo0azaV-nnCsZ-BVbPBVEjZuVi6uojDNHaDlohDCNM2hGL02nASyMhhdWH5yZ6ZjKF2di8IC6HCkDS-VZ5UBb4eryKcmtbKvpDRm7q-knmu_C9GQx3CsNjQIkZhpmoI6asAlrs_DkJK2hgLN_n-lXFBhLDEQnnYMWR1iYLa3yePtSPVHSzzKOODpNPQqZM9oVtNRizEIysesic__qzrHW0bSmEANsnhutwK--2Cs4jc96isl0XQdKfsqTHzcG_Nc5g2-gIegFHnDWYxsh-KgqLtizc4VaBB2oe1BhUN98pIblCkSVgr88PNSPzeqdF6Dz1fjxCqbD1uvuhfPlhiDmcrmLFyf9fzqYzQtOFLyZuojLohGjivsMYhUkSdghen7XkkdvJx-6lK9baVw4kHXp7M1ZbufApnT8wb1PPBmA8Y1TqkeRQkIfBnEbX5G6VWRNiq0AIOWwkvJSwxGLlwL7Kuh7p77JbTqyn-0w1ydDq80bmFKtvnvnf2AQEvmuTFdgSiFAMWJbYlb5o8_nnuGvATqmCd57DanPW8mOsrULpfaTHi=w468-h379-no">
</a>
</div>
<div class="col-2-sm mobile-not">
<div class="text-demo">
<div class="text-prop">
<br>
<font size="3.5"> <strong>Wcsho </strong> </font><br>
<font size="6"> <strong>Demo Site </strong><br></font><br>
<font size="3"> SALES: 888-888-1234<br>
SERVICE: 888-888-1234<br>
Custom: 888-888-1234<br>
</font>
<br>
<font size="2">
<a href="/hours-and-directions/">
918 greenville Rd,<br> uk
</a>
</font>
<br><br>
</div>
<br>
</div>
</div>
<br style="clear:both" />
<div class="col-2-sm">
<a href="/search/">
<img src="https://lh3.googleusercontent.com/xVYh_uJU1fipLAg85BABZvd5rmSTCg-lSFkZR78jP9lCNxjVRHF8dcIkRE_sGh7ReMWs0xo0azaV-nnCsZ-BVbPBVEjZuVi6uojDNHaDlohDCNM2hGL02nASyMhhdWH5yZ6ZjKF2di8IC6HCkDS-VZ5UBb4eryKcmtbKvpDRm7q-knmu_C9GQx3CsNjQIkZhpmoI6asAlrs_DkJK2hgLN_n-lXFBhLDEQnnYMWR1iYLa3yePtSPVHSzzKOODpNPQqZM9oVtNRizEIysesic__qzrHW0bSmEANsnhutwK--2Cs4jc96isl0XQdKfsqTHzcG_Nc5g2-gIegFHnDWYxsh-KgqLtizc4VaBB2oe1BhUN98pIblCkSVgr88PNSPzeqdF6Dz1fjxCqbD1uvuhfPlhiDmcrmLFyf9fzqYzQtOFLyZuojLohGjivsMYhUkSdghen7XkkdvJx-6lK9baVw4kHXp7M1ZbufApnT8wb1PPBmA8Y1TqkeRQkIfBnEbX5G6VWRNiq0AIOWwkvJSwxGLlwL7Kuh7p77JbTqyn-0w1ydDq80bmFKtvnvnf2AQEvmuTFdgSiFAMWJbYlb5o8_nnuGvATqmCd57DanPW8mOsrULpfaTHi=w468-h379-no">
</a>
</div>
<div class="col-2-sm">
<a href="/search/">
<img src="https://lh3.googleusercontent.com/xVYh_uJU1fipLAg85BABZvd5rmSTCg-lSFkZR78jP9lCNxjVRHF8dcIkRE_sGh7ReMWs0xo0azaV-nnCsZ-BVbPBVEjZuVi6uojDNHaDlohDCNM2hGL02nASyMhhdWH5yZ6ZjKF2di8IC6HCkDS-VZ5UBb4eryKcmtbKvpDRm7q-knmu_C9GQx3CsNjQIkZhpmoI6asAlrs_DkJK2hgLN_n-lXFBhLDEQnnYMWR1iYLa3yePtSPVHSzzKOODpNPQqZM9oVtNRizEIysesic__qzrHW0bSmEANsnhutwK--2Cs4jc96isl0XQdKfsqTHzcG_Nc5g2-gIegFHnDWYxsh-KgqLtizc4VaBB2oe1BhUN98pIblCkSVgr88PNSPzeqdF6Dz1fjxCqbD1uvuhfPlhiDmcrmLFyf9fzqYzQtOFLyZuojLohGjivsMYhUkSdghen7XkkdvJx-6lK9baVw4kHXp7M1ZbufApnT8wb1PPBmA8Y1TqkeRQkIfBnEbX5G6VWRNiq0AIOWwkvJSwxGLlwL7Kuh7p77JbTqyn-0w1ydDq80bmFKtvnvnf2AQEvmuTFdgSiFAMWJbYlb5o8_nnuGvATqmCd57DanPW8mOsrULpfaTHi=w468-h379-no">
</a>
</div>
</div>
</div>
</div>
</body>
</html>
Any help would be appreciative, I can't figure out how to get everything to fit equally.
Here is an example using flexbox with pure CSS.
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.row{
display: flex;
}
.col{
flex: 1;
margin: 0 1rem;
border: 1px solid black;
}
.square{
background-color: red;
flex: 1;
}
.square:after{
content: '';
display: block;
padding-bottom: 100%;
}
<div class="row">
<div class="col"></div>
<div class="col row">
<div class="col square"></div>
<div class="col square"></div>
<div class="col square"></div>
<div class="col square"></div>
</div>
</div>
I am making a comment section for my project and I've added display: none to answear__avatar on max-width: 980px and after that those divs are overlaping each other. How do I stop them from overlapping?
Here's my code:
.answear__wraper {
margin-bottom: 10px; }
.answear__answear, .answear__answear--dissucsion {
position: relative;
height: 100%; }
.answear__answear {
width: 100%; }
.answear__answear--dissucsion {
width: 89.4%;
float: right;
}
#media screen and (max-width: 980px) {
.answear__answear--dissucsion {
width: 95%; } }
.answear__avatar {
display: inline-block;
width: 100px;
height: 100%;
}
#media screen and (max-width: 980px) {
.answear__avatar {
display: none; } }
.answear__content {
text-align: left;
position: absolute;
}
<div class="answear_container">
<div class="answear__wraper">
<div class="answear__answear">
<div class="answear__avatar"><img src="images/user0.jpg" class="image__lg" /></div>
<div class="answear__content">
<div class="answear__user">
</div>
</div>
</div>
<div class="answear__answear--dissucsion">
<div class="answear__avatar"><img src="images/user0.jpg" class="image__lg" /></div>
<div class="answear__content">
<div class="answear__user">
</div>
</div>
</div>
</div>
</div>
Use visibility: hidden; the element will still take up the same space as before. The element will be hidden, but still affect the layout.
By using display: none; the page will be displayed as if the element is not there.