I've created a WP site and on the homepage I've added a HTML widget with 3 columns. Everything is good except on mobile device the 3 columns are off to the right of the screen. I can't seem to center them when viewed on mobile as seen in the image below.
<div class="wrapper">
<!-- wp:columns {"columns":3} -->
<div class="wp-block-columns has-3-columns">
<!-- wp:column -->
<div class="wp-block-column"><!-- wp:heading -->
<h2>News</h2>
<!-- /wp:heading -->
<!-- wp:image {"id":482,"align":"center","linkDestination":"custom"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="http://www.patricianprimaryschool.ie/wp-content/uploads/2019/03/Newsletter.png" alt="" class="wp-image-482"/> .
</figure></div>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:heading -->
<h2>Calendar</h2>
<!-- /wp:heading -->
<!-- wp:image {"id":481,"align":"center","linkDestination":"custom"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="http://www.patricianprimaryschool.ie/wp-content/uploads/2019/03/SchoolCalendar-01-1024x1024.png" alt="" class="wp-image-481"/></figure></div>
<!-- /wp:image --></div>
<!-- /wp:column -->
<div class="wp-block-column twitterContainer">
<!-- wp:column -->
<!-- wp:heading -->
<h2>Follow Us</h2>
<!-- /wp:heading -->
<!-- wp:html -->
<a class="twitter-timeline" data-height="300" data-theme="light" href="https://twitter.com/PPSNewbridge?ref_src=twsrc%5Etfw">Tweets by PPSNewbridge</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<!-- /wp:html -->
<!-- /wp:column --></div></div></div>
<!-- /wp:columns -->
And my CSS:
.wp-block-column {
min-width: 220px;
max-width: 550px;
}
.wp-block-columns {
margin: 112px;
}
.wp-block-column {
border: 2px solid #354063;
padding: 2px 10px;
}
Your column divs have maximum width 550px and the parent div has 112px margin. When the screen size is less than (550+120*2) = 790px, the columns are aligning right. To prevent this, use margin 0 when the screen size is less than 800px. Use the following CSS to do that.
#media only screen and (max-width: 800px) {
.wp-block-columns {
margin: 0px;
}
}
Currently your column cannot be less than 220 pixels wide:
.wp-block-column {
min-width: 220px;
}
And the margins of the parent block cause the left edge of the column to be 112 pixels from the left edge of the screen:
.wp-block-columns {
margin: 112px;
}
Due to these two circumstances, the right edge of the column begins to go too far to the right on a narrow screen.
If you just comment on this property, the column will decrease and remain in the center of the mobile phone. But in these keys it becomes unreadable.
You need to change the behavior of this column on a mobile device. On a narrow screen it should occupy almost the entire width of the screen.
For example:
.wp-block-column {
border: 2px solid #354063;
padding: 2px 10px;
margin: 0 auto;
min-width: 220px;
max-width: 80%;
width: 550px;
}
.wp-block-columns {
margin: 112px auto;
}
img {
max-width: 100%;
}
<div class="wrapper">
<!-- wp:columns {"columns":3} -->
<div class="wp-block-columns has-3-columns">
<!-- wp:column -->
<div class="wp-block-column"><!-- wp:heading -->
<h2>News</h2>
<!-- /wp:heading -->
<!-- wp:image {"id":482,"align":"center","linkDestination":"custom"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="http://www.patricianprimaryschool.ie/wp-content/uploads/2019/03/Newsletter.png" alt="" class="wp-image-482"/> .
</figure></div>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:heading -->
<h2>Calendar</h2>
<!-- /wp:heading -->
<!-- wp:image {"id":481,"align":"center","linkDestination":"custom"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="http://www.patricianprimaryschool.ie/wp-content/uploads/2019/03/SchoolCalendar-01-1024x1024.png" alt="" class="wp-image-481"/></figure></div>
<!-- /wp:image --></div>
<!-- /wp:column -->
<div class="wp-block-column twitterContainer">
<!-- wp:column -->
<!-- wp:heading -->
<h2>Follow Us</h2>
<!-- /wp:heading -->
<!-- wp:html -->
<a class="twitter-timeline" data-height="300" data-theme="light" href="https://twitter.com/PPSNewbridge?ref_src=twsrc%5Etfw">Tweets by PPSNewbridge</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<!-- /wp:html -->
<!-- /wp:column --></div></div></div>
<!-- /wp:columns -->
you can adjust for mobile using this
#media only screen and (max-width: 600px) {
//your style goes here
body {
background-color: lightblue;
}
}
for more info visit w3school
Related
I am trying to make this image full size but why some space is remaining right side
CSS/HTML
/* Header */
.header {
background: url('https://picsum.photos/1920/1080') center center no-repeat;
background-size: cover;
}
.header .header-content {
padding-top: 15.5rem;
text-align: left;
}
.header .text-container {
margin-top: 3rem;
margin-bottom: 0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<div id="content">
<!-- start of header -->
<header id="header" class="header">
<div class="header-content"> //here give an class of that image
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="text-container">
<h1><span class="turquoise">StartUp Landing</span> Page Template Free</h1>
<p class="p-large">Use Evolo free landing page template to promote your business startup and generate leads for the offered services</p>
<a class="btn-solid-lg page-scroll" href="#services">DISCOVER</a>
</div>
<!-- end of text-container -->
</div>
<!-- end of col -->
<div class="col-lg-6">
<div class="image-container">
<img class="img-fluid" src="https://picsum.photos/1920/1088" alt="alternative">
</div>
<!-- end of image-container -->
</div>
<!-- end of col -->
</div>
<!-- end of row -->
</div>
<!-- end of container -->
</div>
<!-- end of header-content -->
</header>
<!-- end of header -->
</div>
I want to set this full image right side(question mark)
which place need correction
add the width and height to body and html in head.
html,body {
width:100%;
height:100%
}
.img-fluid{
width:100%
height:100%
}
.image-container{
width:<!--as you wish--> 20px;
height:<!--as you wish--> 20px;
}
I want to make a carousel like the one on this website:
https://debut-demo.myshopify.com/
The words stick with the picture it belongs to in the carousel.
I tried to use position: relative and position: absolute to make the words on the background.
1.My HTML
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">
<h2>title01</h2>
<img src="../src/images/background1.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="../src/images/background2.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="../src/images/background3.jpg" alt="">
</div>
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- If we need scrollbar -->
<div class="swiper-scrollbar"></div>
</div>
2.My SCSS
.swiper-container {
.swiper-slide {
max-height: 700px;
position: relative;
img {
-webkit-filter: brightness(.8);
width: 100%;
}
h2 {
top: 245px;
left: 100px;
font-size: 4.0625rem;
z-index: 20;
position: absolute;
}
}
}
enter image description here
enter image description here
I'm trying to slightly rewrite my application. I have in the past only created applications with Sidenavs, however now I don't need it in a website i'm working on. The issue is I can't seem to find a way to remove the sidenav container without it breaking the background image, the nav bar being sticky, etc. I can't seem to find anything on material.angular.io that refers to anything like this or can fix this.
If anyone knows how to remedy this issue please point me to the documentation/ what I can change to fix this.
Github for the site
With Mat-Sidenav-Container
Sidenav container as a div
div with css taken from the sidenav container
Here is a quick fix
app.component.html
<!-- <mat-sidenav-container fullscreen class="sidenav-container"> -->
<!-- <mat-toolbar class="toolbar"> -->
<!-- <div class="social-media" id="discord" (click)="navigateToDiscord()"> -->
<!-- <img src="../../assets/discord.png"> -->
<!-- </div> -->
<!-- -->
<!-- <div class="social-media" (click)="navigateToTwitch()"> -->
<!-- <img src="../../assets/twitch.png"> -->
<!-- </div> -->
<!-- -->
<!-- <div class="social-media" (click)="navigateToTwitter()"> -->
<!-- <img src="../../assets/twitter.png"> -->
<!-- </div> -->
<!-- -->
<!-- <div class="social-media" (click)="navigateToYoutube()"> -->
<!-- <img src="../../assets/youtube.png"> -->
<!-- </div> -->
<!-- -->
<!-- <div class="themeathon-name"> -->
<!-- <div class="name-span"> -->
<!-- <span>THEMEATHON</span> -->
<!-- </div> -->
<!-- </div> -->
<!-- </mat-toolbar> -->
<!-- -->
<!-- <stream-component></stream-component> -->
<!-- -->
<!-- </mat-sidenav-container> -->
<div class="background">
<div class="toolbar">
<div class="social-media-container">
<div class="social-media" id="discord" (click)="navigateToDiscord()">
<img src="../../assets/discord.png">
</div>
<div class="social-media" (click)="navigateToTwitch()">
<img src="../../assets/twitch.png">
</div>
<div class="social-media" (click)="navigateToTwitter()">
<img src="../../assets/twitter.png">
</div>
<div class="social-media" (click)="navigateToYoutube()">
<img src="../../assets/youtube.png">
</div>
</div>
<div class="themeathon-name">
<div class="name-span">
<span>THEMEATHON</span>
</div>
</div>
</div>
<stream-component></stream-component>
</div>
Added css class .background at app.component.css
.background {
background-image: url(../../assets/japan.jpg);
}
.toolbar {
top: 0;
position: sticky;
position: -webkit-sticky;
z-index: 50;
width: 100%;
background-color: black;
height: 70px;
}
.social-media-container,
.themeathon-name {
position: absolute;
top: calc(50% - 16px);
}
.social-media {
padding-top: 6px;
margin: 0 25px;
cursor: pointer;
display: inline;
}
.social-media img {
fill: #fff;
width: 32px;
height: 32px;
}
.social-media-text {
float: right;
margin-left: 6px;
}
.themeathon-name {
width: 100%;
text-align: center;
}
.themeathon-name span {
font-family: SAMURAI, Roboto, "Helvetica Neue", sans-serif;
font-size: 32px;
color: #fff;
letter-spacing: 10px;
display: block;
margin: auto 26%;
}
Is that what you are after?
Here is the screen when I move down
I made this landing page which worked fine. The background image covered the page and it looked great. I left it and came back a day later and it looks different. I can't see the reason for it. The image wont appear behind the text at all only in the header (check the picture).
<body>
<div class="jumbotron">
<div class="container">
<img src="images/logo1.png" class="logo img-responsive" align="right">
</div>
</div>
<!-- featured content -->
<div class="featured">
<!-- row for grid system / limit space taken by featured content -->
<div class="row">
<!-- use only 9 columns out of 12 for medium and large devices -->
<div class="col-md-9">
<h1> Christopher McConney</h1> <br> <br>
<h3> A creative front end web developer <br> Specialising in responsive and dynamic web pages</h3><br><br>
<p>
<a class="btn btn-default btn-lg" href="index.html"> Find out more </a>
</p>
</div>
</div>
</div>
<!-- footer-->
<div class="footer">
<div class="container">
<p align="right"> © Developed by Christopher McConney 2018 </p>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
The CSS is as follows:
.jumbotron {
background: url(images/background.jpeg) center center ;
background-size:100% 100%;
background-attachment: fixed;
background-repeat: no-repeat;
}
/*logo position and size*/
.logo{
width:85px;
height:65px;
}
.jumbotron logo{
margin-right: 30px;
margin-top: 10px;
}
/*set text colour*/
.featured{
color:lightgrey;
margin-left: 10px;
}
/* space between logo and title */
.featured h1{
padding-top: 60px
}
/*style button*/
.featured .btn-default{
font-weight:bold;
color: lightgrey;
background-color: darkgrey;
border-radius: 10px;
margin-top: 20px;
align-content:center
}
/*style footer*/
.footer{
background-color:rgba(0, 0, 0, 0.5);
color:darkgray;
font-size: 15px;
padding:10px; 0px;
position: absolute;
right: 0;
bottom:0;
left:0;
}
It looks like you closed your jumbotron DIV early. This is what you have:
<div class="jumbotron">
<div class="container">
<img src="images/logo1.png" class="logo img-responsive" align="right">
</div>
</div>
Move both </div> above after the .featured DIVs closing tag.
Well it seems that your .featured div needs to be nested inside your .jumbotron which has the background image. Currently you have it nested outside of the .jumbotron.
The new markup would look like this:
<div class="jumbotron">
<div class="container">
<img src="images/logo1.png" class="logo img-responsive" align="right">
<div class="featured">
<!-- row for grid system / limit space taken by featured content -->
<div class="row">
<!-- use only 9 columns out of 12 for medium and large devices -->
<div class="col-md-9">
<h1> Christopher McConney</h1> <br> <br>
<h3> A creative front end web developer <br> Specialising in responsive and dynamic web pages</h3><br><br>
<p>
<a class="btn btn-default btn-lg" href="index.html"> Find out more </a>
</p>
</div>
</div>
</div>
</div>
</div>
<!-- featured content -->
<!-- footer-->
<div class="footer">
<div class="container">
<p align="right"> © Developed by Christopher McConney 2018 </p>
</div>
</div>
This will also correctly place your Bootstrap .row inside the .container like it's suppose to be.
I'm making a section of the website where there are 3 centered items on the top row and two centered items on the bottom row. I want them aligned like the stars on the American flag.
body {
background-color: #eee;
}
/* ----------------------------- FLIP CIRCLES ----------------------------- */
/* entire container, keeps perspective */
.flip-container {
perspective: 1000px;
}
/* flip the pane when hovered */
.flip-container:hover .flipper {
transform: rotateY(180deg);
}
.flip-container,
.flipping-front,
.flipping-back {
width: 300px;
height: 300px;
display: inline-block;
}
/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
/* hide back of pane during swap */
.flipping-front,
.flipping-back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
/* front pane, placed above back */
.flipping-front {
z-index: 2;
transform: rotateY(0deg);
/* for firefox 31 */
}
/* back, initially hidden pane */
.flipping-back {
transform: rotateY(180deg);
}
.flipper img {
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
}
<!-- START FLIP BLOCK -->
<div style="margin: auto; display: flex">
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
</div>
<!-- START FLIP BLOCK: ROW 2 -->
<div style="margin: auto; display: flex">
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
</div>