Line between divs - html

I want to draw a line between div, but can't figure out how to make <hr> take the length of the main div
Maybe there is some other solution?
I use react and semantic ui comments
create comment block:
const CommentWithReply: FunctionComponent<ICommentProps> = ({ author, createdAt, text, replies }) => (
<div className={styles.comment}>
<BasicComment createdAt={createdAt} text={text} author={author} />
<hr className={styles.hr}></hr>
<div className="comments">
{replies.map(e => (
<CommentWithReply
replies={e.comments}
author={e.author}
createdAt={e.createdAt}
text={e.text}
/>
))}
</div>
</div>
);
Basic comment
const BasicComment: FunctionComponent<IBasicCommentProps> = ({ createdAt, text, author }) => (
<div className={styles.commentInfo}>
<div className={styles.commentAuthor}>
<a href="/" className="avatar">
<img alt="avatar" src="https://i.imgur.com/LaWyPZF.png" />
</a>
<a href="/" className="author">
{author.lastName}
{' '}
{author.lastName}
</a>
<DividerSvg />
<div className="metadata">
<span className="date">{ moment(createdAt).fromNow() }</span>
</div>
</div>
<div className="content">
<div className="text">
{ text }
</div>
<div className="actions">
<DarkBorderButton className={styles.btnReplay} content="Reply" />
</div>
</div>
</div>
);
styles.scss
.comment {
margin-top: 1.25em;
border: 2px solid red;
box-sizing: border-box;
border-radius: 10px;
&:only-child {
&:last-child {
.hr {
visibility: visible;
display: flex;
width: 100%;
}
border: none;
}
}
&:last-child {
margin-bottom: -2em;
.hr {
display: none;
}
&:last-child {
}
}
}
main:
const CommentsFeed: FunctionComponent<ICommentProps> = ({ comments }) => (
<div className={styles.main}>
<p className={styles.commentCounter}> Discussion (58) </p>
<form className="ui reply form">
<div className="field">
<textarea placeholder="Add to the discussion..." />
</div>
<DarkBorderButton className={styles.buttonSend} content="Send" />
</form>
<div className="ui comments">
<div className="comment">
{comments.map(comment => (
<CommentWithReply
createdAt={comment.createdAt}
text={comment.text}
author={comment.author}
replies={comment.comments}
/>
))}
</div>
</div>
</div>
);

Related

Box in css gets colored in a square shape instead of skewed

I'm working on a website. I'm coloring the menu items, but when coloring in the top left image (background color), it gets colored in square.
I would like to have it colored in skewed, so that it follows the black outline.
A screenshot of the problem and some of the html:
Is there anything I could do to make this work?
The html code of the bar:
<div class="iwgh2-bar">
<div class="iw2-layout iw2-default-breakpoint">
<div class="iw2-wrapper iw2-default-margin">
<div class="iw2-inner-wrapper">
<div class="iwgh2-navigation">
<a class="iw2-branded" href="https://www.vlaanderen.be/nl" target="_self">
<div class="iwgh2-branding-logo"></div>
<span>Vlaanderen</span>
</a>
<div class="iw2-menu iw2-menu-has-items" data-show-menu-help="Toon navigatie menu" data-hide-menu-help="Verberg navigatie menu">
<div class="iwgh2-navigation-menu-toggle-wrapper">
<div class="iwgh2-navigation-menu-toggle-animation-wrapper" style="">
<a class="iwgh2-navigation-menu-site" style="" href="http://binnenland.vlaanderen.be">Agentschap Binnenlands Bestuur</a>
<a class="iwgh2-navigation-menu-breadcrumb" style="" href="http://www.gelijkekansen.be">Gelijke Kansen</a>
<a class="iwgh2-navigation-menu-toggle iw2-exclude-from-outbound-link-tracking" href="javascript:;" aria-expanded="false" aria-owns="64ed92f1-fece-e61f-2d15-0af8093d9040" aria-controls="64ed92f1-fece-e61f-2d15-0af8093d9040"><span class="iw2-visually-hidden iw2-help-text"> Toon navigatie menu </span></a>
</div>
</div>
<div class="iwgh2-flyout-wrapper iw2-window-closed" style="display: none; left: 375.4px;" tabindex="-1" id="64ed92f1-fece-e61f-2d15-0af8093d9040">
<div class="iwgh2-search iw2-hidden" role="search">
<div class="iwgh2-form-label">
<label for="iwgh2-search-field">Zoeken</label>
</div>
<div class="iwgh2-form-textfield">
<input id="iwgh2-search-field" class="iwgh2-search-field iwgh2-form-text" name="query" type="search">
</div>
<div class="iwgh2-form-actions">
<div class="iwgh2-form-action">
<div class="iwgh2-form-button">
<input class="iwgh2-form-submit" name="op" value="" type="submit">
</div>
</div>
</div>
</div>
<ul class="iw2-menu-items" tabindex="-1">
<li class="iw2-menu-item"><a class="iw2-menu-item-wrapper" href="http://lokaalbestuur.vlaanderen.be" target="_self">Lokaal Bestuur</a></li>
<li class="iw2-menu-item"><a class="iw2-menu-item-wrapper" href="http://www.thuisindestad.be" target="_self">Vlaams Stedenbeleid</a></li>
<li class="iw2-menu-item"><a class="iw2-menu-item-wrapper" href="http://integratiebeleid.vlaanderen.be" target="_self">Integratie en Inburgering</a></li>
<li class="iw2-menu-item"><a class="iw2-menu-item-wrapper" href="http://www.vlaamserand.be" target="_self">Beleid Vlaamse Rand</a></li>
<li class="iw2-menu-item"><a class="iw2-menu-item-wrapper" href="http://brussel.vlaanderen.be/home.html" target="_self">Beleid Brussel</a></li>
</ul>
</div>
</div>
</div>
<div class="iwgh2-extensions">
<div class="iwgh2-extension-contact" data-show-menu-help="Toon menu" data-hide-menu-help="Verberg menu">
<a class="iwgh2-extension-contact-toggle iw2-exclude-from-outbound-link-tracking" href="http://www.gelijkekansen.be/Praktisch/Contact.aspx" target="_self" aria-owns="906864c8-0db7-9b35-52ce-143b0e4d962a" aria-controls="906864c8-0db7-9b35-52ce-143b0e4d962a" aria-expanded="false"><span class="iw2-visually-hidden iw2-help-text"> Toon menu </span>Contacteer ons</a>
<div class="iwgh2-extension-contact-wrapper iwgh2-flyout-wrapper">
<div class="iwgh2-contact-menu iw2-window-closed iw2-menu-has-items" style="display:none;" tabindex="-1" id="906864c8-0db7-9b35-52ce-143b0e4d962a">
<div class="iwgh2-contact-menu-header">
<span class="iw2-menu-item-title">Gelijke kansen</span>
</div>
<ul class="iw2-menu-items">
<li class="iw2-menu-item iw2-contact-section-entry iw2-contact-section-entry-icon-link iw2-contact-section-entry-type-link"><a class="iw2-menu-item-wrapper" href="http://www.gelijkekansen.be/Praktisch/Contact.aspx" target="_self"><span class="iw2-menu-item-title">Contacteer ons</span>
<div class="iw2-menu-item-description"></div>
</a></li>
<li class="iw2-menu-item iw2-contact-section-entry iw2-contact-section-entry-icon-link iw2-contact-section-entry-type-link"><a class="iw2-menu-item-wrapper" href="http://binnenland.vlaanderen.be/klachten" target="_self"><span class="iw2-menu-item-title">Klachten</span>
<div class="iw2-menu-item-description">Waar kan ik terecht met een klacht?</div>
</a></li>
</ul>
</div>
<div class="iwgh2-windows">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
css:
.iwgh2.iwgh2-redesign .iwgh2-bar {
background-color: #fff;
border-bottom: 1px solid #cbd2da;
}
.iwgh2.iwgh2-redesign.iwgh2-default-margin .iw2-layout .iw2-wrapper.iw2-default-margin {
padding: 0;
}
.iwgh2-bar .iw2-wrapper {
*zoom: 1;
position: relative;
}
.iw2-wrapper .iw2-inner-wrapper {
position: relative;
}
.iwgh2-navigation {
float: left;
white-space: nowrap;
}
.iwgh2.iwgh2-redesign .iwgh2-navigation>a {
color: #333332;
font-size: 1.1875em;
line-height: 2.31579em;
text-transform: none;
transition: color 0.2s;
}
.iwgh2.iwgh2-redesign.iwgh2-redesign-alt .iwgh2-branding-logo {
position: relative;
width: 47px;
background-color: #FFE507;
overflow: hidden;
}
.iwgh2 .iw2-menu {
display: inline-block;
vertical-align: bottom;
position: relative;
}
.iwgh2.iwgh2-redesign.iwgh2-default-margin .iw2-layout {
max-width: none;
}
.iwgh2-bar .iw2-layout {
position: relative;
overflow: visible;
}
Take a look at this fiddle and see if that is what you wanted
#trapezoid {
border-bottom: 100px solid #FFE507;
border-right: 25px solid transparent;
height: 0;
width: 100px;
}
https://jsfiddle.net/CaffeinatedCod3r/r7deqakL/
More CSS Shapes : https://css-tricks.com/the-shapes-of-css/

NPM run build command throws an error on an html file

I have an application developed on anglarJS. when I run the command:
npm run build -- -prod
I get the follwing error
ERROR in ng:///home/directoryling/appname-play.component.html (173,41): The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
the HTML code referred to is as follows:
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">{{incomeM}}</span>$</h4>
</div>
line 173 is </div>, the last line in the code sample.
The part of the TS code where incomeM is assigned is:
this.incomeM = this.householdControlService.getMonthlyIncome();
and getMonthlyIncome() is a function that returns a number.
My question is is it normal for npm to throw such an error here, especially since there is no arithmetic operation in the HTML code. And the variable incomeM is set as a number. And if you have any suggestions on what I can do, or what I need to investigate.
Note I tried removing the handlebar from incomeM:
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">incomeM</span>$</h4>
</div>
the idea being lets 's just print "incomeM" instead of the variable incomeM. However, I still get the same error, except this time it is for the previous element I am using in the HTML file.
here is the full HTML file for your reference:
import { Component } from '#angular/core';
import { MdDialog } from '#angular/material';
import { DragulaService } from 'ng2-dragula/ng2-dragula';
import { Utilities } from '../utilities';
import { Household, SystemParameters, PowerUsage } from '../../models';
import { AfterSimulationService } from '../services/household/after-simulation.service';
import { HouseholdControlService } from '../services/household/household-control.service';
import { HouseSettingService } from '../services/household/house-setting.service';
import { PaymentService, PaymentType } from '../services/household/payment.service';
import { SimulationControlService } from '../services/household/simulation-control.service';
import { SystemParametersService } from '../services/household/system-parameters.service';
import { AlertDialogComponent } from '../shared/dialog/alert-dialog.component';
import { ConfirmationDialogComponent } from '../shared/dialog/confirmation-dialog.component';
import { PaymentDialogComponent } from '../shared/dialog/payment-dialog.component';
#Component({
selector: 'household-play',
templateUrl: './household-play.component.html',
styleUrls: ['./household-play.component.css']
})
export class HouseholdPlayComponent {
initialTime = 0;
elapsedTime = 0;
currentPower = '0.00';
totalEnergy = '0.00';
cost = '0.00';
maxPower = '0.00';
communityCashBox = '0.00';
happinessScore = 1;
household: Household = new Household();
systemParameters: SystemParameters = new SystemParameters();
readyCount = 0;
//initialize income to -1 for debugging purposes.
incomeM = 0;
totalpaid = 0;
isPrepaid = false;
balance = '0.00';
depositAmount = 0;
sellingMode = false;
roomSetting = [[], [], [], []];
powerUsage: PowerUsage;
constructor(
private afterSimulationService: AfterSimulationService,
private dragulaService: DragulaService,
private householdControlService: HouseholdControlService,
private houseSettingService: HouseSettingService,
private paymentService: PaymentService,
private simulationControlService: SimulationControlService,
private systemParametersService: SystemParametersService,
private dialog: MdDialog
) {
dragulaService.setOptions('room-bag', {
revertOnSpill: true
});
dragulaService.drop.subscribe(value => {
houseSettingService.handleRoomOverflow(this.roomNumberByName(value[2].id), this.roomNumberByName(value[3].id))
});
this.roomSetting = houseSettingService.roomSetting;
householdControlService.observable().subscribe(() => {
this.household = householdControlService.household;
});
//store income value for each houshold.
systemParametersService.observable().subscribe(() => {
this.systemParameters = systemParametersService.systemParameters;
this.initialTime = this.systemParameters.simulationStartTime;
this.incomeM = this.householdControlService.getMonthlyIncome();
console.log(typeof(this.incomeM));
this.communityCashBox = this.systemParameters.communityCashBox.toFixed(2);
});
simulationControlService.observable().subscribe(code => {
this.readyCount = simulationControlService.householdReadyCount;
this.elapsedTime = simulationControlService.currentTime
this.maxPower = simulationControlService.maxPower.toFixed(2);
this.totalEnergy = simulationControlService.totalEnergy.toFixed(2);
if (paymentService.paymentType === PaymentType.FLAT_RATE) {
this.cost = (householdControlService.household.flatRateTariff * Math.ceil(this.elapsedTime / (86400*3))).toFixed(2);
}
else {
this.cost = (simulationControlService.totalEnergy * systemParametersService.systemParameters.tariff).toFixed(2);
}
//this.householdControlService.setTotalCostIncurred(parseInt(this.cost));
this.happinessScore = simulationControlService.happinessScore;
this.powerUsage = simulationControlService.powerUsage;
if (simulationControlService.isGameOver) {
dialog.open(AlertDialogComponent, {
disableClose: true,
data: {
title: 'Game Over',
content: 'Please restart the game.'
}
}).afterClosed().subscribe(result => {
window.location.href = '/';
});
}
this.currentPower = this.simulationControlService.isShutdown? '0.00': houseSettingService.getPower().toFixed(2);
if (code === -1) {
this.openAlertDialog('30 Days Simulation Complete.')
paymentService.repay();
}
});
paymentService.observable().subscribe(bill => {
this.isPrepaid = paymentService.paymentType === PaymentType.PREPAID;
this.balance = (paymentService.balance * (simulationControlService.isSimulating? 1: 10)).toFixed(2);
this.currentPower = this.simulationControlService.isShutdown? '0.00': houseSettingService.getPower().toFixed(2);
if (bill === 0) {
return;
}
this.openPaymentDialog(bill);
})
afterSimulationService.observable().subscribe(message => {
if (message === 0) {
return;
}
this.currentPower = this.houseSettingService.getPower().toFixed(2);
if (message instanceof Array) {
this.openAlertDialog(message[0], true);
}
else {
this.openAlertDialog(message);
}
});
}
deposit(amount: number) {
if (amount < 0) {
return;
}
if (!this.simulationControlService.isSimulating) {
return;
}
this.paymentService.deposit(amount);
}
openPaymentDialog(bill) {
this.dialog.open(PaymentDialogComponent, {
disableClose: true,
data: {
current: bill.current,
remain: bill.remain
}
}).afterClosed().subscribe(amount => {
if (amount > this.householdControlService.household.cashBox) {
this.openPaymentDialog(bill);
this.openAlertDialog('Not enough cash.');
return;
}
if (amount < 0) {
this.openAlertDialog('Invalid amount.');
return;
}
this.paymentService.payHouseholdBill(amount);
this.totalpaid += amount;
});
}
openAlertDialog(message, income=false) {
const dialogRef = this.dialog.open(AlertDialogComponent, {
disableClose: true,
data: {
title: message,
content: ''
}
});
if (!income) {
return;
}
dialogRef.afterClosed().subscribe(() => {
this.householdControlService.receiveMonthlyIncome();
this.openAlertDialog('Income Received.');
});
}
private roomNumberByName(name: string): number {
switch(name) {
case 'room0':
return 0;
case 'room1':
return 1;
case 'room2':
return 2;
case 'room3':
return 3;
default:
return 0;
}
}
applianceOnClick(room, index) {
if (this.sellingMode) {
this.sellAppliance(room, index);
}
else {
this.switchAppliance(room, index);
}
}
switchAppliance(room, index) {
this.roomSetting[room][index].on = !this.roomSetting[room][index].on;
this.houseSettingService.setRoomSetting();
this.currentPower = this.houseSettingService.getPower().toFixed(2);
}
sellAppliance(room, index) {
this.dialog.open(ConfirmationDialogComponent, {
disableClose: true,
data: {
title: 'SELL PRODUCT',
content: `You\'re about to sell this product for $${this.houseSettingService.checkSellPrice(room, index)}, are you sure you want to do this?`,
image: this.roomSetting[room][index].image
}
}).afterClosed().subscribe(result => {
if (result) {
this.houseSettingService.sellAppliance(room, index);
this.currentPower = this.houseSettingService.getPower().toFixed(2);
}
});
}
ready() {
this.householdControlService.ready();
}
}
.page {
width: 100vw;
height: 100vh;
background: linear-gradient(180deg, #2E476A, #BFEFFD);
padding: 15px;
min-width: 1024px;
min-height: 768px;
}
.paddingset {
padding: 15px;
}
.household-name {
padding-left: 15px;
color: aliceblue;
margin: 0;
}
/*
.room {
background-image: url(../../assets/images/household-room.svg);
background-size: 100%;
background-position: center;
background-repeat: no-repeat;
margin: 15px;
}
*/
.sell-switch {
background-color: #005E68;
color: aliceblue;
border-top: 30px solid #005E68;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.room-cell-top-left {
background-image: url(../../assets/images/wood-texture.png);
border-top: 10px solid #005E68;
border-left: 10px solid #005E68;
border-bottom: 5px solid #037E8C;
border-right: 5px solid #037E8C;
}
.room-cell-top-right {
background-image: url(../../assets/images/wood-texture.png);
border-top: 10px solid #005E68;
border-right: 10px solid #005E68;
border-bottom: 5px solid #037E8C;
border-left: 5px solid #005E68;
}
.room-cell-bottom-left {
background-image: url(../../assets/images/wood-texture.png);
border-bottom-left-radius: 30px;
border-top: 5px solid #005E68;
border-right: 5px solid #037E8C;
border-bottom: 10px solid #005E68;
border-left: 10px solid #005E68;
}
.room-cell-bottom-right {
background-image: url(../../assets/images/wood-texture.png);
border-bottom-right-radius: 30px;
border-top: 5px solid #005E68;
border-left: 5px solid #005E68;
border-bottom: 10px solid #005E68;
border-right: 10px solid #005E68;
}
.ready, .power-usage, .overview {
background-color: lightgray;
margin: 15px;
border-radius: 10px;
}
.ready-status {
margin: 0;
}
.ready-btn {
background-color: #037E8C;
color: white;
border-radius: 5px;
}
.value {
width: 100px;
margin: 0px 10px;
font-weight: 700;
}
.section-title {
margin: 0;
margin-left: 5px;
}
.overview .stats {
border: 1px solid white;
border-radius: 5px;
margin: 2px;
}
.system-report-btn {
background-color: #037E8C;
width: 50px;
border-radius: 30px;
margin-top: -10px;
}
.system-report-btn img {
height: 95%;
}
.stats-img {
width: 65%;
max-height: 50px;
}
.ready-status, .overview-title {
margin: 0;
}
.overview-title {
color: dimgray;
}
.deposit-btn {
background-color: firebrick;
color: white;
border-radius: 30px;
width: 50px;
}
.deposit-input {
width: 50px;
}
.deposit-confirm {
background-color: #037E8C;
color: aliceblue;
border: 0px;
}
.sidenav {
width: 100vw;
height: 100vh;
border: 1px solid rgba(0, 0, 0, 0.5);
}
.sidenav-btn {
display: flex;
height: 100%;
align-items: center;
justify-content: center;
}
.sidenav-btn img {
height: 80%;
margin-top: 7px;
}
.sidenav-content {
width: 45%;
padding: 20px;
background-color: lightgray;
}
<md-sidenav-container fxFlexFill class="sidenav">
<md-sidenav #sidenav align="end" class="sidenav-content">
<appliance-store></appliance-store>
</md-sidenav>
<div fxLayout="row" fxFlexFill class="page-background">
<div fxLayout="column" fxFlexFill fxFlex="55">
<div fxLayout="row" fxFlex="10" class="paddingset">
<h1 fxFlex="60" class="household-name">{{household.name}}</h1>
<div fxFlex="40" class="sidenav-btn" fxLayoutAlign="end center">
<button md-fab (click)="sidenav.open()">
<img src="../../assets/images/cart-icon.svg">
</button>
</div>
</div>
<div fxLayout="row" fxFlex="25" class="paddingset">
<img fxFlex="95" fxFlexAlign="end" src="../../assets/images/household-house.svg">
<happiness-score fxFlex="5"s [score]="happinessScore"></happiness-score>
</div>
<div fxLayout="column" fxFlexFill fxFlex="65" class="paddingset rooms">
<div fxLayout="row" fxFlex="5" fxLayoutAlign="end end" class="sell-switch">
<div fxFlex="20" fxFlexFill fxLayoutAlign="center end">
<md-slide-toggle labelPosition="before" fxLayoutAlign="end center" class="toggle-switch" color="accent" [(ngModel)]="sellingMode">sell mode</md-slide-toggle>
</div>
</div>
<div fxLayout="row" fxFlex>
<div fxLayout="row" fxFlex fxLayoutWrap class="room-cell-top-left" id="room0" [dragula]='"room-bag"' [dragulaModel]="roomSetting[0]">
<appliance-item fxFlex=33 *ngFor="let item of roomSetting[0]; let i = index;" [item]="item" [selling]="sellingMode" (click)="applianceOnClick(0, i)"></appliance-item>
</div>
<div fxLayout="row" fxFlex fxLayoutWrap class="room-cell-top-right" id="room1" [dragula]='"room-bag"' [dragulaModel]="roomSetting[1]">
<appliance-item fxFlex=33 *ngFor="let item of roomSetting[1]; let i = index;" [item]="item" [selling]="sellingMode" (click)="applianceOnClick(1, i)"></appliance-item>
</div>
</div>
<div fxLayout="row" fxFlex>
<div fxLayout="row" fxFlex fxLayoutWrap class="room-cell-bottom-left" id="room2" [dragula]='"room-bag"' [dragulaModel]="roomSetting[2]">
<appliance-item fxFlex=33 *ngFor="let item of roomSetting[2]; let i = index;" [item]="item" [selling]="sellingMode" (click)="applianceOnClick(2, i)"></appliance-item>
</div>
<div fxLayout="row" fxFlex fxLayoutWrap class="room-cell-bottom-right" id="room3" [dragula]='"room-bag"' [dragulaModel]="roomSetting[3]">
<appliance-item fxFlex=33 *ngFor="let item of roomSetting[3]; let i = index;" [item]="item" [selling]="sellingMode" (click)="applianceOnClick(3, i)"></appliance-item>
</div>
</div>
</div>
</div>
<div fxLayout="column" fxFlexFill fxFlex="45">
<div fxLayout="row" fxFlex="15" class="paddingset ready">
<div fxFlex="25">
<analog-clock [initTime]="initialTime" [elapsedTime]="elapsedTime"></analog-clock>
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="40" fxLayoutAlign="center center">
<h4 class="ready-status"><span class="value">{{readyCount}}</span> of <span class="value">{{systemParameters.numberOfHouseholds}}</span> users <span class="value">is</span> ready</h4>
</div>
<div fxFlex="60" fxLayoutAlign="center end">
<button md-raised-button class="ready-btn" (click)="ready()">I'm Ready!</button>
</div>
</div>
</div>
<div fxFlex class="paddingset power-usage">
<h3 class="section-title">Load Profile</h3>
<combo-chart [powerUsage]="powerUsage" [currentTime]="initialTime+elapsedTime"></combo-chart>
</div>
<div fxLayout="column" fxFlex class="paddingset overview">
<div fxLayout="row" fxFlex="5vh">
<h3 fxFlex="60" class="section-title">Household Overview</h3>
<div fxFlex="40" fxLayoutAlign="end center">
</div>
</div>
<div *ngIf="isPrepaid" fxLayout="row" fxFlex="4vh" class="deposit" fxLayoutAlign="space-between">
<div fxFlexOffset="25" fxFlex="22" fxLayoutAlign="space-between">
<button class="deposit-btn" (click)="deposit(5)">5</button>
<button class="deposit-btn" (click)="deposit(10)">10</button>
</div>
<div fxLayoutAlign="space-around">
<input type="number" class="deposit-input" [(ngModel)]="depositAmount" />
<button class="deposit-confirm" (click)="deposit(depositAmount)">Deposit</button>
</div>
<span class="value" fxFlexAlign="center">$ {{balance}}</span>
</div>
<div fxLayout="row" fxFlex="1 1 auto">
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/cashbox-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Cash Box</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4>$<span class="value">{{household.cashBox.toFixed(2)}}</span></h4>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/communityfund-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Community fund</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4>$<span class="value">{{communityCashBox}}</span></h4>
</div>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="1 1 auto">
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/energyuse-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Energy Use</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">{{totalEnergy}}</span>kWh</h4>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/cost-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Total Cost</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4>$<span class="value">{{cost}}</span></h4>
</div>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="1 1 auto">
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/currentpower-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Current Power</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">{{currentPower}}</span>kW</h4>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/maxpower-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Max Power</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">{{maxPower}}</span>kW</h4>
</div>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="1 1 auto">
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/cashbox-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Income</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">{{incomeM}}</span>$</h4>
</div>
</div>
</div>
<div fxLayout="row" fxFlex="50" class="stats">
<div fxFlex="25" fxLayoutAlign="center center">
<img class="stats-img" src="../../assets/images/cashbox-icon.svg">
</div>
<div fxLayout="column" fxFlex>
<div fxFlex="50" fxLayoutAlign="center center">
<h4 class="overview-title">Outstanding Bill</h4>
</div>
<div fxFlex="50" fxLayoutAlign="center center">
<h4><span class="value">{{(cost-totalpaid).toFixed(2)}}</span>$</h4>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Instead initializing incomeM = 0 make it incomeM: any;

CSS - How to have swiper slider arrows outside of slider that takes up 12 column row

I am using swiper slider and would like to have navigation arrows outside of the slider. What I would basically like to do is the same as it looks like on airbnb site, where slider with images takes up whole 12 column row, but arrows are outside of it.
I am using bootstrap twitter css framework and I have tried various things but nothing worked and don't know how to achieve this?
The css is this:
.swiper-container {
margin-top: 50px;
position: relative;
}
.arrow-left {
position: absolute;
top: 50%;
left: 0;
}
.arrow-right {
position: absolute;
top: 50%;
right: 0;
}
Html looks like this:
<div class="row swiper-container">
<div class="arrow-left">
<i class="ion-chevron-left"></i>
</div>
<div class="col-md-12 swiper-wrapper">
#foreach($videos as $video)
<div class="swiper-slide video-card">
<header class="card__thumb">
<img src="{{ $video->getThumbnail() }}"/>
</header>
<div class="card__body">
<div class="card__category">
</div>
<small>
{{ $video->created_at->diffForHumans() }}
</small>
<span class="video-title">
<p>
#if($video->title != '')
{{ $video->title }} <i class="ion-arrow-right-c"></i>
#else
Untitled
#endif
</p>
</span>
</div>
</div>
#endforeach
</div>
<div class="arrow-right">
<i class="ion-chevron-right"></i>
</div>
</div>
And this is the script:
var carousel = function carousel() {
var mySwiper = new Swiper ('.swiper-container', {
direction: 'horizontal',
nextButton: '.arrow-left',
prevButton: '.arrow-right',
slidesPerView: 4,
simulateTouch: false,
spaceBetween: 15,
breakpoints: {
1181: {
slidesPerView: 4
},
1180: {
slidesPerView: 3
},
1020: {
slidesPerView: 2
},
700: {
slidesPerView: 1
}
}
});
};
$(document).ready(function () {
carousel();
});
I just did this for one of my current projects.
You just have to change the location of the navigation HTML buttons and put them outside the swiper-container. For a better approach and behavior from the library, add a new class to them, and change the element in the JavaScript call.
Example:
<div class="swiper-container">
<div class="swiper-slides"></div>
</div>
<div class="swiper-button-prev-unique"></div>
<div class="swiper-button-next-unique"></div>
let carousel = new Swiper('.swiper-container', {
navigation: {
nextEl: '.swiper-button-next-unique',
prevEl: '.swiper-button-prev-unique'
}
});
That worked perfect, and you can put your arrows outside the wrapper with ease with CSS.
For all my React folks out there:
import { Swiper as SwiperClass } from 'swiper/types';
import { Swiper, SwiperSlide } from 'swiper/react';
export const MySwiper = () => {
const [swiperRef, setSwiperRef] = useState<SwiperClass>();
const theSlides = useMemo(()=> ['slide one', 'slide two'], [])
const handlePrevious = useCallback(() => {
swiperRef?.slidePrev();
}, [swiperRef]);
const handleNext = useCallback(() => {
swiperRef?.slideNext();
}, [swiperRef]);
return (
<div>
<div>
<button onClick={handlePrevious }>
previous
</button>
</div>
<Swiper
onSwiper={setSwiperRef}
>
{theSlides.map((slide) => (<SwiperSlide key={slide}>{slide}</SwiperSlide>)
</Swiper>
<div>
<button onClick={handleNext}>
Next
</button>
</div>
</div>
);
};
If you using multiple swipers then you need to add different class names to swiper-cotainer and pagination arrows. And then create new Swiper and bind each arrows to local swiper.
let arr_next = $('.template-next') //your arrows class name
let arr_prev = $('.template-prev') //your arrows class name
$('.swiper-container--template').each(function (index, element) {
$(this).addClass('swiper' + index);
arr_next[index].classList.add('template-next' + index);
arr_prev[index].classList.add('template-prev' + index);
new Swiper('.swiper' + index, {
slidesPerView: 2,
navigation: {
nextEl: '.template-next'+index,
prevEl: '.template-prev'+index
},
slidesPerView: 2,
//spaceBetween: 100,
loop: true,
breakpoints: {
961: { slidesPerView: 2 },
740: { slidesPerView: 1 },
},
});
});
`
var swiper = new Swiper('.swiper-container', {
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
slidesPerView: 3,
spaceBetween: 10,
autoplay: 3500,
autoplayDisableOnInteraction: false,
loop: true,
breakpoints: {
1024: {
slidesPerView: 3,
spaceBetween: 40
},
768: {
slidesPerView: 3,
spaceBetween: 30
},
640: {
slidesPerView: 2,
spaceBetween: 20
},
320: {
slidesPerView: 1,
spaceBetween: 10
}
}
});
.container{max-width: 600px;margin: 0 auto;}
.swiper_wrap{padding:0px 50px;height:100%;width: 100%;position: relative;display: block;text-align: left;}
.swiper-button-next{
margin-top: 0px;
position: absolute;
top: 50%;
right: -40px;
width: 45px;
height: 45px;
transform: translateY(-50%);
}
.swiper-button-prev{
position: absolute;
top: 50%;
left: -40px;
width: 45px;
height: 45px;
transform: translateY(-50%);
margin-top: 0px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/js/swiper.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/css/swiper.min.css" rel="stylesheet"/>
<div class="container">
<div class="swiper_wrap">
<div class="slider-wrapper">
<div class="swiper-button-prev"></div>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<a href="#">
<img src="http://redsqdesign.co.uk/wp-content/uploads/2017/02/red-square.png">
</a>
</div>
<div class="swiper-slide">
<a href="#">
<img src="http://redsqdesign.co.uk/wp-content/uploads/2017/02/red-square.png">
</a>
</div>
<div class="swiper-slide">
<a href="#">
<img src="http://redsqdesign.co.uk/wp-content/uploads/2017/02/red-square.png">
</a>
</div>
<div class="swiper-slide">
<a href="#">
<img src="http://redsqdesign.co.uk/wp-content/uploads/2017/02/red-square.png">
</a>
</div><div class="swiper-slide">
<a href="#">
<img src="http://redsqdesign.co.uk/wp-content/uploads/2017/02/red-square.png">
</a>
</div>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination"></div>
</div>
<div class="swiper-button-next"></div>
</div>
</div>
</div>
<script src="http://www.jakse.si/test/jakse/taxi/js/swiper.min.js"></script>
This works for me, it is the same like older answer, but maybe it looks better :)
Put this below swiper block:
.section {
.swiper-button-prev {
left: -20px;
}
.swiper-button-next {
right: -20px;
}
}
<div class="section">
<div class="swiper">
<ul class="swiper-wrapper">
<li class="swiper-slide">
</li>
</ul>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
if anyone is interested I've found an easy work-around for this issue
position: fixed; will override the overflow:hidden; of the parent but it will make it appear relative to the root element, adding transform to the wrapper will make it relative again to the parent.
new Swiper(".my-swiper", {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
}
});
.custom-swiper-wrapper {
transform: translate(0, 0);
.swiper-custom-nav {
position: fixed;
}
}
<div class="container custom-swiper-wrapper">
<div class="swiper my-swiper">
<div class="swiper-wrapper">
swiper items here
</div>
<div class="swiper-button-next swiper-custom-nav"></div>
<div class="swiper-button-prev swiper-custom-nav"></div>
</div>
</div>
This is a general solution. To move your arrows outside the container you'll need to first remove the arrow divs from .swiper-container.
Make another bigger container that has .swiper-container and your moved arrows. Give this bigger container position: relative as a reference to arrows that have position: absolute.
Make sure that the .swiper-container width is changed to a value smaller than 100% (e.g. 90% 95%) to avoid overlapping with the arrows.
If you like to keep the .swiper-container width same as that of the entire page width then give -ve margin to the bigger container.
This works if slidesPerView = 1:
.swiper-container {
padding-left: 50px;
padding-right: 50px;
}
.swiper-slide {
visibility: hidden;
}
.swiper-slide.swiper-slide-active {
visibility: visible;
}
In the wrapper function "carousel" we are using to initialize our Swiper instance we can use Swiper's native methods slideNext and slidePrev to add event listeners explicitly to ONLY children of a shared parent element.
1020: {
slidesPerView: 2
},
700: {
slidesPerView: 1
}
}
});
mySwiper.el.parentElement.querySelector(".arrow-left").addEventListener('click',
() => mySwiper.slideNext());
mySwiper.el.parentElement.querySelector(".arrow-right").addEventListener('click',
() => mySwiper.slidePrev());
};
For this to work fully, .swiper-container, .arrow-right and .arrow-left will need to share a wrapper. In Leff's case ".swiper-container" should work just fine:
<div class="row swiper-container">
<div class="arrow-left">
Because this approach allows us to isolate selected elements to a shared parent container, this can be safely used as part of a block of code that might appear more than once.
This is the basic example of how to achieve it. You were close. I slightly modified the code to make it visible within the snippet.
$(document).ready(function () {
var carousel = function carousel() {
var mySwiper = new Swiper ('.swiper-container', {
direction: 'horizontal',
nextButton: '.arrow-left',
prevButton: '.arrow-right',
slidesPerView: 4,
simulateTouch: false,
spaceBetween: 15,
breakpoints: {
1181: {
slidesPerView: 4
},
1180: {
slidesPerView: 3
},
1020: {
slidesPerView: 2
},
700: {
slidesPerView: 1
}
}
});
};
carousel();
});
.row.swiper-container {
margin-top: 50px;
position: relative;
width: 70%;
margin: 0 auto;
}
.arrow-left {
position: absolute;
background: gray;
top: 50%;
left: -40px;
width: 20px;
height: 20px;
transform: translateY(-50%);
}
.arrow-right {
position: absolute;
background: gray;
top: 50%;
right: -40px;
width: 20px;
height: 20px;
transform: translateY(-50%);
}
.swiper-wrapper {
margin: 0 auto;
height: 200px;
background: #f00;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.x.x/css/swiper.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.jquery.min.js"></script>
<div class="row swiper-container">
<div class="arrow-left">
<i class="ion-chevron-left"></i>
</div>
<div class="col-md-12 swiper-wrapper">
<div class="swiper-slide video-card">
<header class="card__thumb">
<img src="{{ $video->getThumbnail() }}"/>
</header>
<div class="card__body">
<div class="card__category">
</div>
<small>
</small>
<span class="video-title">
<p>
</p>
</span>
</div>
</div>
</div>
<div class="arrow-right">
<i class="ion-chevron-right"></i>
</div>
</div>
Ok, I had another method,
What the guys suggesting will not work with multiple sliders on page.
So, I added another two arrows, which will trigger the real arrows.
the swiper had:
{
navigation: {
nextEl: '.xnext',
prevEl: '.xprev',
}
}
$('.swiper-button-next').click(
function(e){
$(this).parents('.swiper-container').find('.xnext').trigger('click');
});
$('.swiper-button-prev').click(function(e){$(this).parents('.swiper-container').find('.xprev').trigger('click');});
The code below help to use more than one swiper, using one class. (At first I was used this in a php loop of swipers)
const swiperContainers = document.querySelectorAll('#swiper-global-container');
const swipers = document.querySelectorAll('#swiper-global-container .swiper');
swipers.forEach((swiper, index) => {
swiper.classList.add(`swiper-${index}`);
})
swiperContainers.forEach((container, index) => {
container.querySelector('.swiper-button-next').classList.add(`swiper-next-${index}`)
container.querySelector('.swiper-button-prev').classList.add(`swiper-prev-${index}`)
})
swipers.forEach((swiper, index) => {
new Swiper(`.swiper-${index}`, {
navigation: {
nextEl: `.swiper-next-${index}`,
prevEl: `.swiper-prev-${index}`,
},
});
});
html,
body {
margin: 0;
padding: 0;
}
main {
display: flex;
flex-direction: column;
min-width: 1300px;
}
#swiper-global-container {
flex: 1;
position: relative;
max-width: 1250px;
margin: 0 auto;
}
.swiper-slide {
max-height: 50vh;
}
.swiper {
max-width: 1200px;
margin: 0 auto;
}
.swiper-button-prev {
left: -50px !important;
}
.swiper-button-next {
right: -50px !important;
}
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<main>
<div id="swiper-global-container">
<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img
src="https://images.unsplash.com/photo-1652961735386-883c83e4d464?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2670"
alt="">
</div>
<div class="swiper-slide">
<img
src="https://images.unsplash.com/photo-1572035563691-0944e6a816d5?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2670"
alt="">
</div>
<div class="swiper-slide">
<img
src="https://images.unsplash.com/photo-1652697911040-52d0453522a6?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2574"
alt="">
</div>
</div>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
<div id="swiper-global-container">
<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img
src="https://images.unsplash.com/photo-1652721684678-a147a957a03e?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2748"
alt="">
</div>
<div class="swiper-slide">
<img
src="https://images.unsplash.com/photo-1652898756182-04023f4135a1?ixlib=rb-1.2.1&raw_url=true&q=80&fm=jpg&crop=entropy&cs=tinysrgb&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2664"
alt="">
</div>
<div class="swiper-slide">
<img
src="https://images.unsplash.com/photo-1652162539309-c96b2694f02b?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1655"
alt="">
</div>
</div>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
</main>
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
I'm using react so I didn't want to go through the trouble of creating new event handlers for each of the toggles. I came up with a solution where you just add an extra div wrapper to the slide content and add padding:
html
<div class="row swiper-container">
<div class="arrow-left">
<i class="ion-chevron-left"></i>
</div>
<div class="col-md-12 swiper-wrapper">
#foreach($videos as $video)
<div class="swiper-slide video-card">
<div class="video-card-inner">
<header class="card__thumb">
<img src="{{ $video->getThumbnail() }}"/>
</header>
<div class="card__body">
<div class="card__category">
</div>
<small>
{{ $video->created_at->diffForHumans() }}
</small>
<span class="video-title">
<p>
#if($video->title != '')
{{ $video->title }} <i class="ion-arrow-right-c"></i>
#else
Untitled
#endif
</p>
</span>
</div>
</div>
</div>
#endforeach
</div>
<div class="arrow-right">
<i class="ion-chevron-right"></i>
</div>
</div>
css
.arrow-left {
left: 0;
}
.arrow-right {
right: 0;
}
.video-card {
padding: 0rem 2rem;
}
The padding within the slide will create a gap with the .video-card-inner element that will house all of your content, thus allowing the arrows to sit outside of your visible content. You can still achieve this with custom toggles, but it will also work with their default toggles.
Just stumbled upon this issue today, here's my attempt at solving it. Basically it only requires you wrapping .swiper-container inside additional .swiper-container-wrapper, as Swiper allows passing references to HTMLElement instead of selector string. And you also get to keep the class names, no discrete classes required for navigation elements or container.
At this point both navigation elements are placed inside .swiper-container-wrapper, as .swiper-container's siblings.
$('.swiper-container-wrapper').each(function (index, element) {
var swiperContainer = $(element).children('.swiper-container').get(0);
var nextEl = $(element).children('.swiper-button-next').get(0);
var prevEl = $(element).children('.swiper-button-prev').get(0);
new Swiper(swiperContainer, {
navigation: {
nextEl: nextEl,
prevEl: prevEl,
},
});
});

Removing Small White Space Under Footer

I've been searching around for a solution to the small sliver of white space which has appeared below my footer but nothing seems to work. I've tried manipulating margin-bottom and padding-bottom to no avail.
The website with the footer is located here: website
The footer in question has a class name of "footerWrapper" and i hope that using the browser DOM editor will give you a better picture of the situation then if i just posted incomplete code. I have tried for a long time to fix this and any suggestions are greatly appreciated.
EDIT: Added code below (I PHP 'included' alot of code, including my footer which created weird formatting. Could this be my problem?)
<body class="body1">
<div class="borderLine"></div>
<div class="banner"></div>
<div class="mainContent1">
<div class="header1">
<div class="headerContainer">
<div class="headerPanelOuter">
<div class="headerPanel">
<p class="panelWelcome">Welcome,
log in or sign up! </p>
<div class="panelButton" id="logInBut">
<span>log in</span>
</div>
<form name="LogOutForm" id="LogOutForm" method="post" action="/app/newstuff.php" style="z-index: 5;">
<div class="panelButton" style="top: 34px;" onclick="SubmitLogOutForm()">
<span>log out</span>
</div>
<input name="LogOutState" type="hidden" value="1">
</form>
<div class="panelButton" onclick="location.href='signup.php';" style="top: 64px;">
<span>sign up</span>
</div>
<div class="panelButton" onclick="location.href='useraccount.php';" style="left: 4px; width: 90px;">
<span>my account</span>
</div>
</div>
</div>
<img class="KELogo" src="/../../images/PRLogo(header).png" alt="Logo">
<img class="KETitleLogo" src="/../../images/KENameLogo(header32).png" alt="People\'s Robotics">
<div id="blackBackg" style="display: none;"></div>
<div id="LogInBox" style="display: none;">
<p id="logEscape" onclick="">x</p>
<p id="logInTitle">Log In</p>
<div id="linediv2"></div>
<form name="logInForm" id="logInForm" method="post" action="/app/newstuff.php" style="z-index: 5;">
<span id="emailField">E-mail:</span>
<br><input id="logEmail" type="text" style="height: 28px;" name="logEmail" value="" onfocus="inputFocus(this)" onblur="inputBlur(this)"> <br><br>
<span id="passField">Password:</span> <br>
<input id="logPass" type="password" style="height: 28px;" name="logPass" value="" onfocus="inputFocus(this)" onblur="inputBlur(this)"> <br><br>
<input id="logSubmit" type="submit" name="logSubmit" value="Log In">
</form>
</div>
<ul class="navList1">
<li><a id="B0" href="/app/newstuff.php" style="background-color: rgb(30, 96, 217); color: rgb(249, 249, 249);">New Stuff</a></li>
<li><a id="B1" href="/app/products.php">Products</a></li>
<li><a id="B2" href="/app/projects.php">Projects</a></li>
<li><a id="B3" href="/app/faq.php">FAQ</a></li>
<li><a id="B4" href="/app/cart.php">My Cart</a></li>
</ul>
</div>
</div>
<div class="content1">
<div id="NSDiv1">
<div id="NSContentContainer">
<section class="slider">
<div class="flexslider">
<ul class="slides">
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 1; display: block; z-index: 2;" class="flex-active-slide" data-thumb-alt="">
<img src="/images/sh3.jpg" alt="1" draggable="false">
</li>
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;" data-thumb-alt="">
<img class="lazy" data-src="/images/sh1.jpg" alt="2" draggable="false" src="/images/sh1.jpg">
</li>
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;" data-thumb-alt="">
<img class="lazy" data-src="/images/sh2.jpg" alt="3" draggable="false">
</li>
</ul>
<ol class="flex-control-nav flex-control-paging"><li>1</li><li>2</li><li>3</li></ol><ul class="flex-direction-nav"><li class="flex-nav-prev"><a class="flex-prev" href="#">Previous</a></li><li class="flex-nav-next"><a class="flex-next" href="#">Next</a></li></ul></div>
</section>
</div>
<div id="NSContentContainer" style=" top: 45px; left: 13px; width: 525px; height: 250px;z-index: 6;">
</div>
</div>
<!-------------------- DIV2----------------- -->
<div id="NSDiv2">
<div id="NSContentContainer" style="height: 250px;">
</div>
<div id="NSContentContainer" style=" top: 45px; left: 13px; width: 525px; height: 400px; ">
<section class="slider">
<div class="flexslider">
<ul class="slides">
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 1; display: block; z-index: 2;" class="flex-active-slide" data-thumb-alt="">
<img src="/images/sh2.jpg" alt="1" draggable="false">
</li>
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;" data-thumb-alt="">
<img class="lazy" data-src="/images/sh3.jpg" alt="2" draggable="false" src="/images/sh3.jpg">
</li>
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;" data-thumb-alt="">
<img class="lazy" data-src="/images/sh1.jpg" alt="3" draggable="false">
</li>
</ul>
<ol class="flex-control-nav flex-control-paging"><li>1</li><li>2</li><li>3</li></ol><ul class="flex-direction-nav"><li class="flex-nav-prev"><a class="flex-prev" href="#">Previous</a></li><li class="flex-nav-next"><a class="flex-next" href="#">Next</a></li></ul></div>
</section>
</div>
</div>
</div>
</div>
<div class="footerWrapper">
<div class="footerInnerContainer">
<div id="footerSection1">
<img id="smlFB" src="/../../images/trans.png" alt="logo">
<img id="smlTW" src="/../../images/trans.png" alt="logo">
<img id="smlIN" src="/../../images/trans.png" alt="logo">
<img id="smlYT" src="/../../images/trans.png" alt="logo">
<div id="fsm1">
</div><div id="fsm2">
</div><div id="fsm3">
</div>
</div><div id="footerSection2">
<!-- <img src="/../../images/mysterychest1.jpg" alt="0" style="position: absolute; left: 25px; top: 13px;">
<img src="/../../images/mysterychest(top2).png" alt="0" style="position: absolute; left: 25px; top: 4px;">-->
<!-- <span style="position: absolute; top: 175px; left: 100px; font-size: 16px;">Hobbiests serving Hobbiests</span>-->
</div><div id="footerSection3">
<form>
<span>Something to say?</span>
<textarea rows="5" cols="30" name="userMessage"> </textarea>
<span>Topic:</span>
<select>
<option>Bug report</option>
<option>Suggestions</option>
<option>Other</option>
</select>
<span>Email Address:</span>
<input type="text" name="UserEmail">
<input type="submit" value="Submit">
</form>
</div>
</div>
</div>
<link rel="stylesheet" href="/../FlexSlider/flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="/../FlexSlider/jquery.flexslider-min.js"></script>
<script>
$(window).load(function () {
$('.flexslider').flexslider({
touch: true,
slideshow: true,
controlNav: true,
directionNav : true,
slideshowSpeed: 6000,
animationSpeed: 600,
initDelay: 0,
pauseOnAction: true,
start: function(slider) { // fires when the slider loads the first slide
var slide_count = slider.count - 1;
$('.slides').on('click', function () {
$(this).siblings('.flex-direction-nav').children('li').children('a.flex-next').trigger('click');
});
$(slider)
.find('img.lazy:eq(0)')
.each(function() {
var src = $(this).attr('data-src');
$(this).attr('src', src).removeProp('data-src');
});
},
before: function (slider) { // fires asynchronously with each slider animation
var slides = slider.slides,
index = slider.animatingTo,
$slide = $(slides[index]),
$img = $slide.find('img[data-src]'),
current = index,
nxt_slide = current + 1,
prev_slide = current - 1;
$slide
.parent()
.find('img.lazy:eq(' + current + '), img.lazy:eq(' + prev_slide + '), img.lazy:eq(' + nxt_slide + ')')
.each(function () {
var src = $(this).attr('data-src');
$(this).attr('src', src).removeProp('data-src');
});
},
// default setting
after: function(slider) {
/* auto-restart player if paused after action */
if (!slider.playing) {
slider.play();
}
}
});
});
</script>
<script>
function checkUrl(url) {
switch (url) {
case "":
return 1;
break;
case "newstuff.php": //REMOVE THIS AFTER
return 1;
break;
case "products.php":
return 2;
break;
case "projects.php":
return 3;
break;
case "faq.php":
return 4;
break;
case "cart.php":
return 5;
break;
}
}
$(document).ready(function () {
var array = window.location.pathname.split('/');
var lastsegment = array[array.length - 1];
$("ul.navList1 > li:nth-child(" + checkUrl(lastsegment) + ") > a").css({ "background-color": "#1E60D9", "color": "#f9f9f9" });
$("#logInBut").click(function () {
$("#LogInBox").fadeIn(1000);
$("#blackBackg").fadeIn(1000);
});
$("#blackBackg").click(function () {
$("#LogInBox").fadeOut(1000);
$("#blackBackg").fadeOut(1000);
});
$("#logEscape").click(function () {
$("#LogInBox").fadeOut(1000);
$("#blackBackg").fadeOut(1000);
});
$(".panelButton").mouseenter(function () {
$("span", this).css("color", "#f9f9f9");
$(this).css("background-color", "transparent");
});
$(".panelButton").mouseleave(function () {
$("span", this).css("color", "#222423");
$(this).css("background-color", "#f9f9f9");
});
$("ul.navList1 > li").mouseenter(function () {
$("a", this).css({ "background-color": "#1B4DA9", "color": "#f9f9f9" }); //#1B4DA9 , #001E56
});
$("ul.navList1 > li").mouseleave(function () {
$("a", this).css({ "background-color": "transparent", "color": "#1e1e1e" });
var array = window.location.pathname.split('/');
var lastsegment = array[array.length - 1];
$("ul.navList1 > li:nth-child(" + checkUrl(lastsegment) + ") > a").css({ "background-color": "#1E60D9", "color": "#f9f9f9" });
});
});
function navButtonHighlight() {
var url = window.location.pathname;
if (url == "/Template.php") {
document.getElementById("LogOutForm")
}
}
function SubmitLogOutForm() {
document.getElementById("LogOutForm").submit();
}
</script>
</body>
Well this is because of overflow, you need to use overflow:hidden in your css like this
.footerWrapper {
overflow:hidden;
}
It'll be all fine
Working Fine.
.footerInnerContainer{
display:block;
}
The above answers didn't work for me, but this did. Hope it helps somebody out.
.footerWrapper {
position: absolute;
bottom: -5px;
}

Change style inline to css

I have these form with style inline, but I can't use it in css because it changes all my code when I reference css in another views:
<style>
body {
background: url('http://digitalresult.com/') fixed;
background-size: cover;
padding: 0;
margin: 0;
}
.form-login {
background-color: #EDEDED;
padding-top: 10px;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
border-radius: 15px;
border-color:#d2d2d2;
border-width: 5px;
box-shadow:0 1px 0 #cfcfcf;
opacity: 0.8;
}
h4 {
border:0 solid #fff;
border-bottom-width:1px;
padding-bottom:10px;
text-align: center;
}
.form-control {
border-radius: 10px;
}
.wrapper {
text-align: center;
}
</style>
#using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { #class = "form-horizontal", role = "form" }))
{
#Html.AntiForgeryToken()
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="container" style="margin-top:40px">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<div class="panel panel-default form-login">
<div class="panel-heading">
<strong> Press to continue</strong>
</div>
<div class="panel-body">
<form role="form" action="#" method="POST">
<fieldset>
<div class="row">
</div>
<div class="row">
<div class="col-sm-12 col-md-10 col-md-offset-1 ">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-user"></i>
</span>
#Html.TextBoxFor(m => m.Email, new { #class = "form-control has-success", #autofocus = "autofocus", placeholder = "Usuario", required = "required" })
#Html.ValidationMessageFor(m => m.Email, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-lock"></i>
</span>
#Html.TextBoxFor(m => m.Password, new { #class = "form-control has-success", placeholder = "Password", type = "password", required = "required" })
#Html.ValidationMessageFor(m => m.Password, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
</div>
<p>#Html.ActionLink("Return to home page", "Index", "Home")</p>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
I think the problem is if I send body class to css it changes on all pages I reference css, how can I change to only change in this view? Regards
Instead of changing in file, you may add style in page through tag or give inline style with style element if you need change only at one place.
But adding inline style should be avoided.
Better to differentiate your element with a id and give properties to it
In that case you can save above inline CSS into separate CSS file and import that css file to that HTML page where you want this CSS.
Add the background to container, or add another class to the container and apply the style. and change margin-top to padding-top
.container {
background: url('http://digitalresult.com/') fixed;
background-size: cover;
padding: 0;
margin: 0;
height: 100vh;
padding-top:40px;
}
you can create a CSS file with the styles you mentioned in your view and import that file only in this view which will solve your problem.