Ionic app not responsive need help in scss - css

I have done the app which is clone of wouldyourather . i have a problem its working fine on samsung normal size devices . but in bigger screen phone its not responsive if any one can help how ill do this to responsive on every device ?
i know just need to change some css if any one can help ? Thanks
html
<ion-navbar color="grey" center>
<ion-title >Would You Rather ?</ion-title>
<ion-buttons class="bttn" right><button right class="bttn" (click)="presentPrompt()"> <ion-icon color="light" name="md-more"></ion-icon></button></ion-buttons>
</ion-navbar>
</ion-header>
<ion-content class="background">
<ion-slides *ngIf="questions" #slides (ionSlideDidChange)="slideChanged()" class="slidee">
<ion-slide *ngFor="let question of questions | async; let i = index;" >
<!-- <div class="orca">
this is for or round
</div> -->
<!-- <h3>Question {{i+1}}</h3> -->
<div class="quizcontainer" >
<div class="upper" text-center (click)="show(question.ckc)" (click)="clickedButton(1,question.would)" >
<p *ngIf="showclicks" style="color: white" item-end class="p1">{{ clickPercentage1 }}% </p>
<div class="another"><p class="q1" style="text-align: center;">{{question.would}}</p> </div>
</div>
<div class="or" style="color: white" ><p class="pp">OR </p></div>
<div class="down" text-center (click)="show(question.ckc)" (click)="clickedButton(2,question.rather)" >
<p *ngIf="showclicks" style="color: white" item-end class="p1">{{ clickPercentage2 }}% </p>
<div class="another"> <p class="q1" >{{question.rather}}</p></div>
</div>
</div>
</ion-slide>
</ion-slides>
</ion-content>
scss
page-newp {
ion-icon {
font-size: 40px; //Preferred size here
}
.bttn{
background-color: transparent; // <===== For change the icon background color //
}
ion-title {
text-align: center;
font-family: "Comic Sans MS" !important;
font-weight: 650 !important;
}
.upper{ // <==== Red Box / uppwer box class //
position: relative;
background-color: red !important; // <===== For change the red color //
height: 50% !important;
color: white;
justify-content: center;
align-items: center;
}
.background {
background-color: #383838; //<==== For change the Background color //
}
.pp {
text-align: center;
font-family: "Comic Sans MS" !important;
font-weight: 500;
font-size:22px;
}
.or{
margin-top: -15px;
position: relative;
height: 0%;
height: 0.2%;
}
.down{ //<==== Blue Box / lower box class //
position: relative;
margin-top: 33px;
width: 100%;
background-color: blue !important; // <===== For change the blue color //
height: 60% !important;
color: white;
justify-content: center;
align-items: center;
}
.another { //<===== Question postion //
position: absolute;
text-align: center;
width: 100%;
top: 30px;
}
.slidee {
margin-top: -30px !important;
}
.q1{
text-align: center !important;
font-family: Comic Sans MS !important; font-size: 25px !important; text-align: center;
}
.p1{
position: absolute;
margin-left: 300px;
font-family: Comic Sans MS !important;
font-size: 23px !important;
}
ion-item{
background-color: transparent !important;
}
.quizcontainer{
height: 520px;
widhth: 100%;
}
h1{
color: white !important;
}
/* .orca{
width: 100px;
height: 100px;
background-color: aqua;
position: absolute;
margin-top: 60%;
margin-left: auto;
border-radius: 50%;
} */
}
this is iphonex in web

Use media queries with different device port Size so that it can be render across different screens

Related

Moving a tag to the top of a todo bar

The spent text with the teal background is meant to be a tag, and I want the tag to appear above the todo bar...kind of like this:
Like a small rectangle on top of a big one. So the tag would be on the top left corner of the todo bar. How would I achieve this? I've tried doing margin to the tag, but that did not work out at all.
CSS for the tag (style.css)
.tag {
color: white;
font-size: 15px;
font-weight: 400;
letter-spacing: 2px;
text-transform: uppercase;
background: #36d1dc;
padding: 3px;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
React JS code for the tag part (Todo.js)
<li className={`todo-item${todo.completed ? "completed" : ""}`}>
{isSpent && <p className="tag">Spent</p>}
{isReceived && <p className="tag">Received</p>} ${text}
</li>
In case anyone needs the whole of the todo.css file: https://pastecode.io/s/s5XZ9e3DRW
If you need anymore information, or if my question was poorly phrased, please tell me. Any help is very much appreciated. Thank you!
I think if yow will separate the tag and the navbar to two different div tags and put them on main div something like:
<div id="wrapper">
<div id="top-left">top left div</div>
<div id="down">down side div</div>
</div>
and the css will be something like (using grid on the main div):
#wrapper {
display: grid;
}
#top-left {
background: green;
width: 250px;
float:left;
margin-right: 20px;
}
#down {
background: blue;
float:left;
width: 500px;
}
the result is:
I would go with something like this, where input:focus could be a class set on on .container, for example, if the input has any values.
I couldn't understand why you used li and p in your original code, because you need to override so much stuff to make it look nice.
Using "rem" over a fixed pixel value is also preferred if you want to create a responsive site, where you just override the font-size in the body to make everything scale.
.container {
position: relative;
display: flex;
}
body,
input {
padding: 1rem;
}
.container.selected > .todo-item,
input:focus ~ .todo-item {
transform: translateY(-1rem);
}
.todo-item {
position: absolute;
left: 1rem;
transform: translateY(1rem);
transition: transform 400ms;
}
.tag {
color: white;
font-size: 15px;
font-weight: 400;
letter-spacing: 2px;
text-transform: uppercase;
background: #36d1dc;
padding: 3px;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
<div class="container">
<input type="number">
<div class="todo-item"><span class="tag">Spent</span></div>
<div style="padding-top: 1rem"><-- select this input</div>
</div>
<div class="selected container" style="padding-top: 2rem">
<input type="number">
<div class="todo-item"><span class="tag">Spent</span></div>
</div>
body {
background-color: #48AEE0;
}
.container {
height: 200px;
width: 500px;
display: flex;
flex-direction: column;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.tag {
color: white;
font-size: 15px;
font-weight: 400;
letter-spacing: 2px;
text-transform: uppercase;
background: #36d1dc;
padding: 3px;
width: 80px;
text-align: center;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
.other {
margin: 0;
display: inline-flex;
flex-direction: column;
}
input {
height: 30px;
width: 200px;
border: white;
margin: 0;
}
<div class="container">
<div class="tag">spent</div>
<div class="others">
<input type="text">
</div>
</div>

How to overlay 2 elements over image

In my photographic portfolio, I display a series of images of different ratio in tracks that automatically fill the width of the display. That is working perfectly... after receiving some help.
My ultimate objective is to permanently display a little heart over the top-left corner of each image AND display a semitransparent strip over the bottom of each image containing the caption only on mouseover the image.
I have almost achieved that result but I can not figure out after hours of trying how to overlay the 2 elements as explained above... so for now trhey are together on top of the image... which is not optimal.
So I would appreciate some help to achieve that result if possible.
Here is part of the code in question and a sample can be found on my website : TwoOverlaysOnImage.
CSS code
.my-flex-item {
background-color: #1d1d1d;
border: 2px solid #1d1d1d;
height: 100px;
}
.img-holder {
position: relative;
display: inline-block;
}
.img-holder p {
position: absolute;
display: inline-block;
text-align: left !important;
font-size: 0.7em !important;
width: 100%;
}
.img-holder:hover > p {
background-color: rgba(60,60,60,0.7);
text-align: center !important;
}
.img-holder span {
margin-top:40px;
color: white !important;
left: 30px;
}
HTML code
<div class="d-flex flex-row flex-wrap justify-content-center">
<div class="img-holder">
<p>
<img src="heart0.png" style="margin-left:6px; margin-top:4px;"/>
<span class="thumbCaption">caption</span>
</p>
<a href="modal...">
<img class="my-flex-item" src="imagepath..." alt="caption..." />
</a>
</div>
</div>
Try this:
html:
<div style="width: 100%; display: flex; justify-content: center;">
<div id="img-cont" class="img-cont">
<img class="heart" src="path/to/heart/icon">
<div class = "hover">
<p>Sample Text</p>
</div>
</div>
</div>
CSS:
.img-cont{
position: relative;
width: 420px;
height: 300px;
cursor: pointer;
background-size: cover;
background-image: url("https://images.unsplash.com/photo-1588876315093-ce09afb34028?ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80")
}
.img-cont .heart{
position: absolute;
color: white;
top: 15px;
left: 15px;
cursor: pointer;
}
.hover{
clip-path: url(#img-cont);
position: absolute;
height: 0;
width: 100%;
bottom: 0px;
background-color: rgba(0, 0, 0, 0.5);
transition: all 0.3s ease;
}
.img-cont:hover .hover{
height: 50%;
}
.hover p{
color: white;
}

How to make text start at space place on x-axis (different divs)

This may seem like a simple question and may have a simple solution but I was wondering how I can get two text elements (from a button) start at the space spot on the x-axis (they are two different divs). I am referring to the button's text in the image below.
How can I get both the text "Dashboard" and "A new button" to start at the same position on the x axis?
* {
margin: 0;
padding: 0;
}
body {
background-color: #ced4da;
font-family: sans-serif;
}
.wrapper {
height: 100vh;
}
input[type="button"] {
border: none;
background-color: Transparent;
outline: none;
height: 20px;
width: 92%;
font-size: 13px;
font-weight: regular;
color: white;
}
.side-bar {
display: flex;
flex-direction: column;
width: 17%;
height: 100%;
background-color: #272C32;
}
.sub-title {
margin-top: 10%;
margin-left: 7.5%;
}
.sub-title h3 {
color: #B9B9B9;
font-size: 13px;
font-weight: lighter;
}
.splitter {
display: flex;
align-self: center;
width: 85%;
height: 0.5px;
background-color: grey;
margin-top: 12px;
margin-bottom: 4%;
}
.button {
position: relative;
margin-left: 7.5%;
margin-bottom: 3%;
}
.button form i {
color: white;
font-size: 14px;
transition: 0.3s;
position: absolute;
left: 0px;
top: 0px;
padding: 5px 0px;
}
.button input:hover+i {
color: dodgerblue;
}
<div class="wrapper">
<div class="side-bar">
<div class="sub-title">
<h3>ADMIN TOOLS<h3>
</div>
<div class="splitter"></div>
<div class="button">
<form>
<input type="button" value="Dashboard" onclick="window.location.href='http://www.google.com'"/>
<i class="fas fa-tachometer-alt fa-lg" aria-hidden="true"></i>
</form>
</div>
<div class="button">
<form>
<input type="button" value="A new button" onclick="window.location.href='http://www.google.com'"/>
<i class="fas fa-hand-paper fa-lg" aria-hidden="true"></i>
</form>
</div>
</div>
<div class="nav-bar"></div>
</div>
And if you have time, how does my CSS code look? I am still learning and would like some feedback too if you don't mind :) Thanks!
All you have to do is put a <div> element around your <form> element s, then set its position to wherever you want it, and its text-align: left;. BTW your CSS looks excellent, just keep in mind that some things can be simplified, e.g.
{margin: 0; padding: 0;}
This is very good, but * is the same as body, even though it's documented differently. * applies to all the content, but content is only displayed if it's in the <body> element.
Very good looking however, keep it up!
P.S. I'd vote you up if I could, but I'm out of votes - I'll do it tomorrow

Twitter Boostrap bugs in Buttons just in firefox and IE?

I have some unusual behaviour on my portfolio website in firefox. I am using twitter bootstrap.The text on buttons is going beyond the button width, also nothing happens on clicking the buttons. It works fine on chrome and safari.
Link: www.nakibmomin.com
html
<div class="parallax-overlay"></div>
<div class="jumbotron" id="home">
<div class="container">
<img class="img-circle" src="img/profile.jpg" style="width: 100px;height:100px;">
<h1>Nakib Momin</h1>
<p>Student Blogger And Software Developer</p>
<button type="button" class="btn btn-primary">Contact Me</button>
</div>
</div>
css
.parallax-overlay {
position: absolute;
left: 0;
top: 120;
width: 100%;
height: 100%;
background-image: url(../img/pattern.png);
background-repeat: repeat;
background-color: rgba(44,62,80,0.4);
z-index: 2;
min-height: 460px;
}
.jumbotron {
background-image:url('../img/main.jpg');
height: 100%;
font-family: 'Hammersmith One', sans-serif;
text-transform: uppercase;
letter-spacing: 6px;
text-align: center;
min-height: 460px;
}
.jumbotron .container {
position: relative;
top:120px;
}
.jumbotron h1, .jumbotron p, .jumbotron a, .jumbotron button, .jumbotron img
{
position: relative;
z-index: 3;
}
.jumbotron img
{
margin-bottom: 5px;
padding: 2px;
}
.jumbotron button
{
margin-top: 18px;
width: 130px;
}
.jumbotron h1 {
color: #fff;
font-size: 48px;
padding: 10px;
font-weight: bold;
}
.jumbotron p {
font-size: 12px;
color: #e3e3e3;
}
.jumbotron a {
font-size: 15px;
color:#fff;
text-decoration: none;
}
Don't put anchor tags inside of button tags.
Either make it an actual button and redirect users to your contact me page when they click it, or style the button using Bootstrap's button classes.
BOOTPLY
HTML:
Contact Me
You can't put <a>s inside <button>s. They don't work properly and it's very unclear what proper behavior for such a combination would even be.

Space after html5's video tag

I have a html5's video tag, it seems that there is a 5px space between video and its container div element.
If I put font-size: 0 in the container element (#video-container), the space disappears.
I know this is a problem of display: inline-block, but I have no elements with that.
Also, trying the solutions of opening tags next the previous closing, didn't delete the space.
http://jsfiddle.net/g9t71mg6/
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#wrapper {
width: 100%;
height: 100%;
}
#video-container {
overflow: hidden;
width: 100%;
background: #2c5894;
}
#video-container video {
width: 100%;
}
#turnera-container {
float: right;
width: 250px;
vertical-align: top;
height: 100%;
}
.turno-wrapper {
height: 25%;
display: table;
width: 100%;
}
.turno-wrapper {
background: #727867;
}
.turno {
border: dashed 1px #FFFFFF;
display: table-cell;
text-align: center;
vertical-align: middle;
}
.turno .numero {
font-size: 50px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFF;
}
.turno .box {
font-size: 30px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFF;
}
#contenido-principal {
overflow: hidden;
height: 100%;
/*margin-right: 250px;*/
}
#footer {
background-color: #dc001e;
height: 100%;
width: auto;
border: dashed 1px #FFFFFF;
}
#rss-container {
height: 240px;
font-size: 12px;
}
.turno-asignado-historia0 {
background: #00bc24;
}
.turno-asignado-historia0 .numero {
font-size: 65px;
}
.turno-asignado-historia0 .box {
font-size: 40px;
}
.turno-asignado-historia1 {
background: #739461;
}
.turno-asignado-historia2 {
background: #546947;
}
.turno-asignado-historia3 {
background: #34422e;
}
<div id="wrapper">
<div id="turnera-container">
<div class="turno-wrapper turno-asignado-historia0">
<div class="turno">
</div>
</div>
<div class="turno-wrapper turno-asignado-historia1">
<div class="turno">
</div>
</div>
<div class="turno-wrapper turno-asignado-historia2">
<div class="turno">
</div>
</div>
<div class="turno-wrapper turno-asignado-historia3">
<div class="turno">
</div>
</div>
</div>
<div id="contenido-principal">
<div id="video-container">
<video autoplay loop="loop">
<source src="http://awakenvideo.org/video/UFOs/NVofu001.mp4" type="video/mp4">
</video>
</div>
<div id="footer">
<div id="rss-container">
</div>
</div>
</div>
</div>
Just add display: block to the video element. video elements default to display: inline, causing the whitespace.
Updated fiddle: http://jsfiddle.net/g9t71mg6/1/
It is also worth noting that the reason for the so called "space" below or above in some inline video is because of the line-height that is defined on the container. So setting line-height: 0 on the container of the video tag would also remove the space
for your video is fullscreen (height and width 100%), use propertie css:
object-fit: cover;

Resources