I trying to fix figcaption but with no results.
whats the problem?
<style>
.items {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 40px 20px;
}
figcaption.name {
padding: 8px 15px;
text-align: center;
background: #EEE;
color: #444;
font-weight: 600;
max-height: 30px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
figcaption.year {
background: #EEE;
color: #444;
font-weight: 100;
text-align:left;
}
#media only screen and (max-width: 1000px){.items {grid-template-columns: repeat(5, 1fr);}}
#media only screen and (max-width: 800px) {.items {grid-template-columns: repeat(4, 1fr);}}
#media only screen and (max-width: 600px) {.items {grid-template-columns: repeat(3, 1fr);}}
#media only screen and (max-width: 400px) {.items {grid-template-columns: repeat(2, 1fr);}}
</style>
https://jsfiddle.net/zup37bjv/
Trying to edit this code, use div over figure ? whats the solution?
p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 200px;
}
.wrapper {
padding: 20px;
background: #eaeaea;
max-width: 400px;
margin: 50px auto;
}
.demo-1 {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.demo-2 {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-width: 150px;
}
<div class="wrapper">
<p class="demo-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut odio temporibus voluptas error distinctio hic quae corrupti vero doloribus optio! Inventore ex quaerat modi blanditiis soluta maiores illum, ab velit.</p>
</div>
<div class="wrapper">
<p class="demo-2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut odio temporibus voluptas error distinctio hic quae corrupti vero doloribus optio! Inventore ex quaerat modi blanditiis soluta maiores illum, ab velit.</p>
</div>
Related
I need help getting the header title (h2,h3,h4) region always appear in the top right corner of their respective div region, no matter what view is being displayed.
Also, the header content keeps overflowing as I shrink the web browser, how can I stop that from running over?
I tried moving the margins and the padding of the header, and the header won't move to the right past 350px.
I tried to adjust the size of the div to allow the header to move top right.
Should I have used the "section element" instead of div?
I haven't tried using absolute or relative positioning.
/********** Base styles **********/
* {
font-family: arial, sans-serif, helvetica;
font-style: normal;
font-size: 16px;
box-sizing: border-box;
margin: 0;
padding: 0;
color: rebeccapurple;
}
h1 {
text-align: center;
font-size: 175%;
margin-bottom: 40px;
color: black;
}
h2,
h3,
h4 {
font-size: 125%;
text-align: center;
font-weight: bold;
border: 1px solid black;
max-width: 30%;
margin-bottom: 5px;
position: relative;
bottom: 11px;
left: 231px;
}
h2 {
background-color: Pink;
color: black;
}
h3 {
background-color: red;
color: white;
}
h4 {
background-color: greenyellow;
color: black;
}
div {
background-color: lightgray;
padding: 10px 0px 10px 10px;
border: 1px solid black;
margin: 0 auto;
margin-bottom: 10px;
max-width: 400px;
position: relative;
}
/*Large devices*/
#media (min-width: 992px) {
.box1 {
float: left;
margin-left: 20px;
margin-right: 60px;
max-width: 30%
}
.box2 {
float: left;
max-width: 30%;
}
.box3 {
float: right;
max-width: 30%;
margin-right: 20px;
}
h2,
h3,
h4 {
position: relative;
left: 70.2%;
}
}
/*Medium devices*/
#media (min-width: 768px) and (max-width:991px) {
.box1 {
float: left;
max-width: 43%;
margin-bottom: 30px;
margin-left: 40px;
margin-right: 0px;
}
.box2 {
float: right;
max-width: 43%;
margin-bottom: 30px;
margin-right: 40px;
}
.box3 {
margin-top: 40px;
clear: both;
max-width: 100%;
margin-left: 40px;
margin-right: 40px;
}
h2,
h3,
h4 {
position: relative;
left: 70.2%;
}
}
}
/*small devices*/
#media (max-width:767px) {
div {
margin-top: 30px;
}
h2,
h3,
h4 {
position: relative;
left: 100%;
}
}
<!DOCTYPE html>
<html lang="en-CA">
<head>
<meta charset="utf-8">
<title> Our Menu </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/STYLE.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Our Menu </h1>
<div class="box1">
<h2>Meat</h2>
<p id="p1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
<div class="box2">
<h3>Pizza</h3>
<p id="p2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
<div class="box3">
<h4>Salads</h4>
<p id="p3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
</body>
</html>
/********** Base styles **********/
* {
font-family: arial, sans-serif, helvetica;
font-style: normal;
font-size: 16px;
box-sizing: border-box;
margin: 0;
padding: 0;
color: rebeccapurple;
}
h1 {
text-align: center;
font-size: 175%;
margin-bottom: 40px;
color: black;
}
h2,
h3,
h4 {
font-size: 125%;
text-align: center;
font-weight: bold;
border: 1px solid black;
max-width: 30%;
margin-left: 310px;
margin-bottom: 5px;
margin-top: 0px;
padding: 0px;
}
h2 {
background-color: Pink;
color: black;
}
h3 {
background-color: red;
color: white;
}
h4 {
background-color: greenyellow;
color: black;
}
div {
background-color: lightgray;
padding: 10px 0px 10px 10px;
border: 1px solid black;
margin: 0 auto;
margin-bottom: 10px;
max-width: 400px;
}
/*Large devices*/
#media (min-width: 992px) {
.box1 {
float: left;
margin-left: 20px;
margin-right: 60px;
max-width: 30%
}
.box2 {
float: left;
max-width: 30%;
}
.box3 {
float: right;
max-width: 30%;
margin-right: 20px;
}
}
/*Medium devices*/
#media (min-width: 768px) and (max-width:991px) {
.box1 {
float: left;
max-width: 43%;
margin-bottom: 30px;
margin-left: 40px;
margin-right: 0px;
}
.box2 {
float: right;
max-width: 43%;
margin-bottom: 30px;
margin-right: 40px;
}
.box3 {
margin-top: 40px;
clear: both;
max-width: 100%;
margin-left: 40px;
margin-right: 40px;
}
}
/*small devices*/
#media (max-width:767px) {
div {
margin-top: 30px;
}
}
<!DOCTYPE html>
<html lang="en-CA">
<head>
<meta charset="utf-8">
<title> Our Menu </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/STYLE.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Our Menu </h1>
<div class="box1">
<h2>Meat</h2>
<p id="p1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
<div class="box2">
<h3>Pizza</h3>
<p id="p2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
<div class="box3">
<h4>Salads</h4>
<p id="p3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
</body>
</html>
So, a few things to go over:
First off, you don't need to use different heading tags for the same hierarchical elements. You already have your first heading as your title, and since you don't have anything that follows you can stick with just <h2> from there.
We can use CSS specificity to target your various headings to change the colors as you prefer. You could also have done this with ids, classes, really there are several ways to approach any layout in CSS; this is just what I chose for simplicity.
floats are very outdated and have been replaced by flex-box techniques which we're going to use to position your headers on your menu items. Could we use position attributes? Sure. But if we're using flex already, we can take advantage of what it's capable of to position elements using a container element to house all of your items and then make the items themselves utilize flex as well.
We can use align-self: flex-end; to position your <h2> tags as needed and then add some margin to give them some breathing room away from the edges of the menuItems.
There's much more that can be done here, but I think this cleans it up quite nicely and you get a much simpler, more easily-responsive layout with less code and less attributes.
Hopefully, that covers everything. Let me know if you have any questions! Thanks for updating your post after my comment. Make sure to keep that in mind moving forward ;)
/********** Base styles **********/
* {
font-family: arial, sans-serif, helvetica;
font-style: normal;
font-size: 16px;
box-sizing: border-box;
margin: 0;
padding: 0;
color: rebeccapurple;
}
.container {
display: flex;
flex-direction: row;
background: transparent;
width: 100vw;
flex-wrap: wrap;
gap: 10px;
padding: 20px;
}
.menuItem {
display: flex;
flex-direction: column;
background-color: lightgray;
padding: 0px 0px 10px 10px;
border: 1px solid black;
margin: 0 auto;
flex: 1 1 32%;
min-width: 400px;
}
h1 {
text-align: center;
font-size: 175%;
margin-bottom: 40px;
color: black;
}
h2 {
font-size: 125%;
text-align: center;
font-weight: bold;
border: 1px solid black;
border-top: 0px;
border-right: 0px;
align-self: flex-end;
padding: 5px 20px;
}
.container .menuItem:nth-child(1) h2 {
background-color: Pink;
color: black;
}
.container .menuItem:nth-child(2) h2 {
background-color: red;
color: white;
}
.container .menuItem:nth-child(3) h2 {
background-color: greenyellow;
color: black;
}
<!DOCTYPE html>
<html lang="en-CA">
<head>
<meta charset="utf-8">
<title> Our Menu </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/STYLE.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Our Menu </h1>
<div class="container">
<div class="menuItem">
<h2>Meat</h2>
<p id="p1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
<div class="menuItem">
<h2>Pizza</h2>
<p id="p2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
<div class="menuItem">
<h2>Salads</h2>
<p id="p3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit error quis ab perspiciatis eos inventore recusandae iste itaque numquam facilis, tenetur. Doloribus officiis quae facilis, nisi, ex similique. Animi, perferendis</p>
</div>
</div>
</body>
</html>
I'm still a rookie, trying to learn HTML and CSS. I'm trying to use 1fr 1fr grid for my "welcome" section. Idea is to put an image on the left side, and text on the right side.
When i go to Inspect and try to see it in Responsive mode, my grid colapses when width goes below 1300, or when height goes below 900.
This is my first section after header, so my question is how should I handle this situation? I don't want to build entire page like this and then realize that I need hundreds of lines of media queries because I used the wrong concept from the beginning :)
I'm trying to get something like this: Example
Below is my code:
.welcome {
padding: 7em 0;
display: flex;
justify-content: center;
}
.welcome-container {
display: grid;
justify-content: center;
align-content: stretch;
grid-template-columns: 1fr 1fr;
width: 100%;
height: 100%;
background-color: white;
height: 50vh;
width: 50vw;
overflow: hidden;
}
.welcome-left {
padding: 3em;
border: 1px blue solid;
text-align: center;
}
.welcome-img {
background-image: url(../../img/tetiana-padurets-B-xb7VFtlZg-unsplash.jpg);
width: 100%;
height: 100%;
}
.img {
display: block;
}
.welcome-right {
border: 1px red solid;
padding: 5em 3em;
}
.welcome-title {
text-align: center;
color: #3f3f3f;
font-weight: 400;
margin-top: 1em;
}
<section class="welcome">
<div class="welcome-container">
<div class="welcome-left">
<div class="welcome-img"></div>
</div>
<div class="welcome-right">
<h2 class="welcome-title"><span>Lorem Ipsum!</h2></span>
<p class="welcome-desc">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint dolor voluptas quo id maiores distinctio quidem, voluptatum voluptates dolorem eum eius vitae. Doloremque maiores, inventore vel error perferendis necessitatibus quae debitis cumque ipsa explicabo facere soluta vero asperiores, voluptates reprehenderit labore accusantium dolores.
</p>
</div>
</div>
</section>
Cheers!
<section class="welcome">
<div class="welcome-container">
<div class="welcome-left">
<div class="welcome-img">
<img class="image" src="https://i.picsum.photos/id/237/200/300.jpg?hmac=TmmQSbShHz9CdQm0NkEjx1Dyh_Y984R9LpNrpvH2D_U">
</div>
</div>
<div class="welcome-right">
<h2 class="welcome-title"><span>Lorem Ipsum!</h2></span>
<p class="welcome-desc">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint dolor voluptas quo id maiores distinctio quidem, voluptatum voluptates dolorem eum eius vitae. Doloremque maiores, inventore vel error perferendis necessitatibus quae debitis cumque ipsa explicabo facere soluta vero asperiores, voluptates reprehenderit labore accusantium dolores.
</p>
</div>
</div>
</section>
In CSS
.welcome {
display: flex;
justify-content: center;
width: 100%;
}
.welcome-container {
display: grid;
justify-content: center;
align-content: stretch;
grid-template-columns: 1fr 1fr;
background-color: white;
width: 50vw;
}
.welcome-left {
padding: 10px;
border: 1px blue solid;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.image {
width: 100%;
height: auto;
}
.img {
display: block;
}
.welcome-right {
border: 1px red solid;
padding: 10px;
}
.welcome-title {
text-align: center;
color: #3f3f3f;
font-weight: 400;
font-size: 2vw;
margin-top: 1em;
}
.welcome-desc {
font-size: 1vw;
}
.welcome-img {
width: 100%;
}
I guess you want something like this.
I'm using css grid to make my layout. I would like to hide my details row and only show sidebar row in media query (max-576px). When i want to see Details row i should do click in "Show detail" button and hide Sidebar row. I have tried different ways but i couldn't achieve solve.
I really appreciate any helps .
My code
* {
margin: 0;
padding: 0;
}
.container {
margin: 0;
height: 100%;
display: grid;
grid-template-columns: 100%;
grid-template-rows: 40px 1fr;
grid-column-gap: 0;
}
.header {
background-color: #ececec;
}
.main {
background-color: yellow;
display: grid;
grid-template-columns: 40px 1fr;
}
.apps {
background-color: lightgrey;
}
.content {
background-color: blue;
display: grid;
grid-template-columns: 100%;
grid-template-rows: auto 1fr;
}
.content-header {
background-color: red;
/* display: flex; */
}
.content-body {
background-color: antiquewhite;
display: grid;
grid-template-columns: 250px 1fr;
grid-template-rows: 1fr;
}
.sidebar-panel {
background-color: aquamarine;
}
.sidebar-button,
.detail-panel-button {
display: none;
}
.details-panel {
background-color: cyan;
}
#media screen and (max-width:576px) {
.main {
grid-template-columns: 100%;
grid-template-rows: 1fr 40px;
}
.content {
order: 1;
}
.apps {
order: 2
}
.content-body {
grid-template-columns: 1fr;
grid-template-rows: 1fr;
}
.sidebar-panel {
display: block;
}
.details-panel {
display: none;
}
.sidebar-button,
.detail-panel-button {
display: block;
}
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
<div class="container">
<div class="header">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Eveniet, expedita.
</div>
<div class="main">
<div class="apps">
App1 <br>
App2
</div>
<div class="content">
<div class="content-header">
<div style="height: 40px;">
Ribbon
</div>
</div>
<div class="content-body">
<div class="sidebar-panel">
<h3>Sidebar</h3>
<button class="sidebar-button">Show Detail</button>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Laboriosam reprehenderit suscipit
molestias minus velit earum sed quasi tenetur sit voluptate.
</div>
<div class="detail-panel">
<h3>Detail</h3>
<button class="detail-panel-button">Show Sidebar</button>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis ex nam, laudantium cumque
voluptas aliquid harum esse veniam deserunt numquam. Odit tenetur sunt, harum laborum
voluptatibus pariatur. Ad, nemo ipsa iure recusandae dignissimos iusto odio libero sapiente
neque! Tenetur et quam magnam, numquam assumenda a aut! Dignissimos, sit. Impedit modi
necessitatibus alias voluptatum odio ipsum enim quam eum, harum animi quidem, itaque
</div>
</div>
</div>
</div>
</div>
Damn it bro
You made a tiny little mistake. Just modify .details-panel to .detail-panel.
And pls paste this <meta name="viewport" content="width=device-width, initial-scale=1"> inside your <head> tag
I've seen similar questions regarding this issue, but they are either related to the mobile version of Safari, or they relate to javascript issues. Neither of those, I think, are the issue my page is having.
I have a simple paragraph of text that gets centered horizontally using CSS, and the text is responsive so that it scales and wraps within the viewport to always fit and have a specific percentage width of the viewport.
The CSS works perfectly fine in every browser except that in Safari, when the window is narrower than the MAX-width of the paragraph, the paragraph upon page load initially starts out left justified to the viewport. Only after scaling the viewport manually by even one pixel, or hovering over the menu items which have their own CSS styling, does the paragraph get properly centered.
I am not sure what part of all the code involved I should be including here, so any help would be appreciated.
Thanks.
I've added a link to a codepen I just created with a stripped-down version of the code, but the codepen itself doesn't show the error, so I've attached screen shots in the attached image.
https://codepen.io/anon/pen/MZEOMQ
* {
margin: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body, html {
background-color: black;
}
.info_wrapperClass {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
}
.infoNoticeParagraphBugreportClass {
font-size: calc(11px + .5vw);
}
#supports ((display: -ms-grid) or (display: grid)) {
.info_wrapperClass {
display: -ms-grid;
display: grid;
-ms-grid-columns: 1fr auto 1fr;
grid-template-columns: 1fr auto 1fr;
-ms-grid-rows: auto 1vh auto 1vh auto 1vh auto 1vh auto 1vh -webkit-min-content;
-ms-grid-rows: auto 1vh auto 1vh auto 1vh auto 1vh auto 1vh min-content;
grid-template-rows: auto auto auto auto auto -webkit-min-content;
grid-template-rows: auto auto auto auto auto min-content;
grid-row-gap: 1vh;
grid-template-areas:
". info_heading_area ."
". info_notice_area ."
". info_blog_heading_area ."
". info_text_area ."
". separator_line_area ."
". innerwrapper .";
}
.info_headingClass {
-ms-grid-row: 1;
-ms-grid-column: 2;
grid-area: info_heading_area;
}
.infoNoticeParagraphClass {
-ms-grid-row: 3;
-ms-grid-column: 2;
grid-area: info_notice_area;
}
.info_blog_headingClass {
-ms-grid-row: 5;
-ms-grid-column: 2;
grid-area: info_blog_heading_area;
}
.infoBlogParagraphClass {
-ms-grid-row: 7;
-ms-grid-column: 2;
grid-area: info_text_area;
}
}
.info_headingClass {
margin-top: 40px;
}
.infoNoticeParagraphClass {
padding-bottom: 40px;
max-width: 100vw;
-ms-flex-item-align: center;
-ms-grid-row-align: center;
align-self: center;
margin-top: 4vh;
}
.infoNoticeParagraphClass p {
margin-left: 5vw;
margin-right: 5vw;
max-width: 60em;
min-width: 20em;
}
.info_blog_headingClass {
-ms-flex-item-align: center;
-ms-grid-row-align: center;
align-self: center;
margin-top: 4vh;
}
.infoBlogParagraphClass {
padding-bottom: 40px;
max-width: 100vw;
-ms-flex-item-align: center;
-ms-grid-row-align: center;
align-self: center;
margin-left: auto;
margin-right: auto;
margin-top: 4vh;
}
.infoBlogParagraphClass p, h3 {
margin-left: 5vw;
margin-right: 5vw;
max-width: 60em;
min-width: 20em;
}
h1.info_headingClass {
font-weight: bold;
font-size: calc(20px + .5vw);
text-align: center;
font-family: Verdana, Geneva, sans-serif;
color: white;
}
.infoNoticeParagraphClass p {
font-size: calc(12px + .5vw);
text-align: center;
font-family: Verdana, Geneva, sans-serif;
color: red;
}
h2.info_blog_headingClass {
font-weight: bold;
font-size: calc(18px + .5vw);
text-align: center;
font-family: Verdana, Geneva, sans-serif;
color: white;
}
.infoBlogParagraphClass > h3 {
font-weight: bold;
text-decoration: underline;
text-align: left;
font-size: calc(12px + .5vw);
font-family: Verdana, Geneva, sans-serif;
padding-bottom: .5em;
color: white;
}
.infoBlogParagraphClass > p {
text-align: left;
padding-bottom: 1ch;
line-height: 1.25em;
font-size: calc(12px + .25vw);
font-family: Verdana, Geneva, sans-serif;
color: white;
}
#media screen and (min-width: 1400px) {
h1.info_headingClass {
font-size: 1.75em;
}
.infoNoticeParagraphClass p {
font-size: 1.2em;
}
.infoNoticeParagraphBugreportClass {
font-size: 1.2em;
}
h2.info_blog_headingClass {
font-size: 1.7em;
}
.infoBlogParagraphClass > h3 {
font-size: 1.25em;
}
.infoBlogParagraphClass > p {
font-size: 1em;
}
}
#media screen and (max-width: 479px) {
.info_headingClass {
margin-top: 10px;
}
.infoNoticeParagraphClass {
padding-bottom: 10px;
max-width: 90vw;
min-width: 60vw;
}
.infoBlogParagraphClass {
padding-bottom: 10px;
max-width: 90vw;
min-width: 60vw;
}
.infoBlogParagraphClass p, h3 {
margin-left: 5vw;
margin-right: 5vw;
max-width: 50em;
min-width: 20em;
}
h1.info_headingClass {
font-size: calc(16px + .5vw);
}
.infoNoticeParagraphClass p {
font-size: calc(10px + .5vw);
}
h2.info_blog_headingClass {
font-size: calc(14px + .5vw);
}
.infoBlogParagraphClass > p{
padding-bottom: 1ch;
font-size: calc(10px + .5vw);
}
}
<div class="pagecontainer">
<div class="info_wrapperClass">
<h1 class="info_headingClass">Lorem Ipsum</h1>
<div class="infoNoticeParagraphClass">
<p style="color: lightgreen;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore possimus ipsam iure repellendus. Odit sit eveniet laboriosam dolores volupt</p>
<br>
<p class="infoNoticeParagraphBugreportClass">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat sit, beatae, a neque dolorum temporibus! Corporis aliquam obcaecati rerum praesentium ducimus sequi consectetur, consequuntur, error deserunt ea quos autem similique, sapiente ratione nostrum? Magnam quos obcaecati error rerum ipsa rem itaque ipsam at, natus dicta facilis. Odit provident</p>
</div>
<h2 class="info_blog_headingClass">Lorem</h2>
<div class="infoBlogParagraphClass">
<h3>Lorem ipsum dolor sit amet, elit. Ab</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi placeat perspiciatis magnam, atque voluptatibus veritatis. Velit inventore doloribus minus, nisi incidunt eum ea beatae possimus, enim ipsam earum laborum nostrum</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores, commodi magnam sequi, sed, velit quos quasi rerum numquam animi nam laboriosam. Voluptas</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Hic similique incidunt quas autem atque, voluptatem quaerat illum possimus vitae nulla. Aliquam ea at iusto aut odit necessitatibus ex exercitationem quae quasi sunt laudantium, ratione voluptatem optio commodi quisquam sequi, molestiae in, vel eum quod eveniet laboriosam tenetur.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum voluptates libero totam placeat optio nemo, quos voluptate velit ullam possimusa?</p>
</div>
</div>
</div>
When I resize browsers window, my div gets down to bottom and a big space comes in top. I want that my div should remain in center of page even if resize the size of window lesser than size of div. In my school they haven't teach about this but I want to align this div in center of page
<!DOCTYPE html>
<html>
<head>
<title>CSS centering Done Right.</title>
<style>
* {
margin: 0;
padding: 0;
}
html, body, .m {
height: 100%;
width: 100%;
}
.m {
opacity:1;
font-size: 0;
overflow: auto;
text-align: center;
/*styling>>*/
background-color: #8F1C10;
}
.m::before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.m>div {
display: inline-block;
font-size: 19px;
margin: 20px;
max-width: 320px;
min-height: 20px;
min-width: 300px;
padding: 14px;
vertical-align: middle;
/*styling*/
color:white;
background-color: #140A08;
outline:none;
}
</style>
</head>
<body>
<title>CSS centering Done Right.</title>
<div class="m">
<div contenteditable="true">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis, enim, possimus, voluptates, quia voluptatibus voluptas eum quaerat iure aperiam asperiores debitis fuga itaque quibusdam a ad odio assumenda iusto voluptatem.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quidem, ex quia consequatur quae quasi amet veniam est quas error quos perferendis ducimus non similique in soluta magnam dolore molestias veritatis.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate, doloremque iste magni in eveniet ipsa odio mollitia eligendi magnam placeat aliquam hic reprehenderit reiciendis itaque assumenda ratione delectus. Alias, quis.</div>
</div>
</body>
</html>
margin: auto; is what you need. Try this:
<style>
* {
margin: 0;
padding: 0;
}
/*html, body, .m {
height: 100%;
width: 100%;
}*/
.m {
opacity:1;
font-size: 0;
overflow: auto;
text-align: center;
margin: auto;
/*styling>>*/
background-color: #8F1C10;
}
.m::before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.m>div {
display: inline-block;
font-size: 19px;
margin: 20px;
max-width: 320px;
min-height: 20px;
min-width: 300px;
padding: 14px;
vertical-align: middle;
/*styling*/
color:white;
background-color: #140A08;
outline:none;
}
</style>