Having trouble getting rid of white space around my body element. I am setting margin and padding to 0 in both my css and html, but when I run the application the body has a margin of 8px. When I look in the developer tools it says the body styles is coming from User Agent Stylesheet. I think my problem has something to do with that. Any help would be greatly appreciated!
html {
overflow: hidden;
background-size: 100% 100%;
background-color: lightgrey;
margin-bottom: 0;
margin: 0;
padding: 0;
}
/* Add a black background color to the top navigation */
.topnav {
background-color: #22aedc;
overflow: hidden;
height: 60px;
}
/* Style the links inside the navigation bar */
.topnav h2 {
color: #FFFFFF;
text-align: center, center;
align-content: center, center;
//padding: 4px 10px;
text-decoration: none;
font-size: 21px;
font: "Tahoma";
overflow: hidden;
}
footer {
font: "Tahoma";
font-size: 13px;
opacity: 0.8;
}
body {
background-image: url('/Angular/src/assets/img/kraft.png');
background-repeat: no-repeat;
background-position-x: center;
background-position-y: 330px;
background-attachment: fixed;
margin: 0;
overflow: visible;
padding: 0;
}
.dv-panel {
padding: 10px;
text-align: center;
border: 1px solid darkgray;
box-shadow: 4px 4px 6px rgba(0,0,0,0.2);
background: #f6f8f9;
background: -moz-linear-gradient(top, #f6f8f9 0%, #e5ebee 50%, #d7dee3 51%, #f5f7f9 100%);
background: -webkit-linear-gradient(top, #f6f8f9 0%, #e5ebee 50%, #d7dee3 51%, #f5f7f9 100%);
background: linear-gradient(to bottom, #f6f8f9 0%, #e5ebee 50%, #d7dee3 51%, #f5f7f9 100%);
}
.dv-menuPanel {
#extend .dv-panel;
background: #f9f9f9;
max-width: 1200px;
margin: auto;
// Added 'row' class to make height match
// that of children
//overflow: hidden;
.dv-menuPanelContent {
min-height: 300px;
background: white;
padding: 10px;
box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
.menuPanelHeader {
background: #5bc0de;
color: white;
h3 {
padding: 10px;
margin-top: 0;
}
}
.menuPanelHeaderAlt {
color: #555;
h3 {
padding: 10px;
margin-top: 0;
//font-size: 32px;
}
}
.contentPanelHeaderAlt {
color: #555;
}
}
}
.dv-panel, .dv-menuPanel, .dv-menuPanelAlt {
padding: 10px;
text-align: center;
border: 1px solid darkgray;
box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.2);
background: #f6f8f9;
background: -moz-linear-gradient(top, #f6f8f9 0%, #e5ebee 50%, #d7dee3 51%, #f5f7f9 100%);
background: -webkit-linear-gradient(top, #f6f8f9 0%, #e5ebee 50%, #d7dee3 51%, #f5f7f9 100%);
background: linear-gradient(to bottom, #f6f8f9 0%, #e5ebee 50%, #d7dee3 51%, #f5f7f9 100%);
}
.dv-panel {
padding: 10px;
text-align: center;
border: 1px solid darkgray;
box-shadow: 4px 4px 6px rgba(0,0,0,0.2);
background: #f6f8f9;
}
.dv-button {
display: block;
background-color: #5bc0de;
border-color: #46b8da;
padding: 17px 16px;
width: 100%;
border: 1px solid transparent;
outline: none;
text-align: center;
cursor: pointer;
transition: 0.3s;
color: white;
white-space: nowrap;
box-sizing: border-box;
font-weight: 400;
margin-bottom: 8px;
font: Tahoma;
font-size: 15px;
}
.dv-button:hover {
background-color: #EEE;
color: black;
}
.db-button:active {
background-color: aqua;
color: white;
}
.plant-button {
display: block;
background-color: #5bc0de;
border-color: #46b8da;
padding: 10px 16px;
width: 100%;
border: 1px solid transparent;
outline: none;
text-align: center;
cursor: pointer;
transition: 0.3s;
color: white;
white-space: nowrap;
box-sizing: border-box;
font-weight: 400;
margin-bottom: 8px;
font: Tahoma;
font-size: 14px;
}
.plant-button:hover {
background-color: #EEE;
color: black;
}
.plant-button:active {
background-color: aqua;
color: white;
}
.pagination {
display: block;
background-color: white;
border-color: white;
padding: 10px 16px;
width: 50px;
border: 1px solid transparent;
outline: none;
text-align: center;
cursor: pointer;
transition: 0.3s;
color: grey;
white-space: nowrap;
box-sizing: border-box;
font-weight: 400;
margin-bottom: 8px;
font: Tahoma;
font-size: 15px;
border-top: 40px;
}
.pagination:hover {
background-color: #EEE;
color: black;
}
.pagination:active {
background-color: aqua;
color: white;
}
#back {
float: left;
margin-left: 10px;
margin-right: 10px;
margin-top: 0px;
margin-bottom: 10px;
background-color: #008cba;
border-color: #0079a1;
color: white;
cursor: pointer;
border: 1px solid transparent;
font-weight: 400;
text-align: center;
display: inline-block;
padding: 8px 12px;
outline: none
}
#back:hover {
background-color: white;
color: black;
}
#back:active {
background-color: #6e6d6f;
color: white;
}
.import-header {
display: block;
background-color: #5bc0de;
border-color: #46b8da;
padding: 17px 16px;
width: 100%;
border: 1px solid transparent;
outline: none;
text-align: center;
transition: 0.3s;
color: white;
white-space: nowrap;
box-sizing: border-box;
font-weight: 400;
margin-bottom: 8px;
font: Tahoma;
font-size: 15px;
}
<html>
<head>
<link rel="stylesheet" href="/Angular/src/assets/css/fontawesome.min.css" />
</head>
<body style="background-color: lightgrey; width: 100%; margin: 0px; padding: 0px">
<div style="padding-top: 5px; padding-left: 5px; padding-right: 5px">
<div class="topnav">
<h2 style="text-align: center">Import</h2>
<i class="fa fa-youtube" aria-hidden="true"></i>
</div>
</div>
<div *ngIf="!isTypeCollapsed" style="justify-content:center; padding-top: 155px; padding-bottom: 375px">
<div class="dv-panel" style="width: 400px; margin: auto; padding-bottom: 2px">
<div *ngFor="let type of types">
<button (click)="togglePlants(type)" class="dv-button">
{{type}}
</button>
</div>
</div>
</div>
<div *ngIf="isPlantsCollapsed" style="justify-content:center; padding-top: 125px; padding-bottom: 129px">
<div class="dv-panel" style="width: 400px; margin: auto; overflow: hidden; margin-left: 733px">
<button (click)="toggleBack()" class="far fa-arrow-left" id="back"></button>
<div *ngFor="let plant of plants">
<button class="plant-button" (click)="hidePlants(plant)">{{ plant }}</button>
</div>
</div>
</div>
<div *ngIf="isImportPageCollapsed" style="justify-content:center; padding-top: 165px; padding-bottom: 283px">
<div class="dv-panel" style="width: 400px; height: 300px; margin: auto; padding-bottom: 100px; background-color: #f9f9f9">
<button (click)="toggleBackFromImportPage()" class="far fa-arrow-left" id="back"></button>
<button (click)="toggleHome()" class="far fa-home" id="back" style="margin-left: -9px"></button>
<div>
<button class="import-header">
{{ importPlant }} ~ {{importType}}
</button>
<div class="form-group" style="width: 370px; margin: auto 0px auto 0px; position: relative; display: block; padding-top: 30px; padding-bottom: 45px; align-content: center">
<div class="input-group" style="margin-right: 125px; position: relative; display: table; border-collapse: separate">
<span class="input-group-addon fad fa-file-search" style="display: table-cell; background: #5bc0de; color: white; font-size: 14px; padding: 10px 12px"></span>
<input [value]="file?.name" class="form-control" readonly type="text" style="text-align:justify; padding: 10px 90px; outline: none; box-sizing: border-box; background-color: #EEE; opacity: 1; border: 1px solid #ccc">
<label style="opacity: 0; width: 100%; position: absolute; height: 100%; top: 0; left: 0; z-index: 999; cursor: pointer; outline: none; background-color: #f9f9f9">
<input style="position: relative; z-index: 2; float: left; width: 100%; margin-bottom: 0; align-items:baseline; text-align: center" id="fileInput; background-color: #f9f9f9" type="file" accept=".xls,.xlsx" hidden (change)="getFileDetails($event)">
</label>
</div>
</div>
<div style="padding-left: 140px">
<button (click)="onImportClick()" class="dv-button" style="width: 100px; padding: 4px 6px">
Import
</button>
</div>
</div>
</div>
</div>
<footer style="padding-top: 0px; padding-bottom: 7px; text-align:center">
<p>Version 1.0.0 © 2021 DreamVersion, LLC.</p>
</footer>
</body>
</html>
INDEX.HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body style="margin: 0px !important; padding: 0px !important">
<app-root></app-root>
</body>
</html>
Related
I have a container div that is a background that changes size dynamically with the window. Inside that container I have an image div that I want to change size with the background container. I can't seem to get it to resize dynamically even using percentage heights and widths. Can anyone guide me in the correct direction?
#import url("https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600,700,800");
* {
box-sizing: border-box;
}
body {
background-color: #af39fe;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
min-height: 100vh;
font-family: "Fira Sans", sans-serif;
display: flex;
}
.info-container {
width: 95%;
position: relative;
max-width: 800px;
margin: auto;
background: #fff;
box-shadow: 0px 14px 80px rgba(34, 35, 58, 0.2);
padding: 25px;
border-radius: 10px;
height: auto;
}
.info-container__img {
width: 400px;
flex-shrink: 0;
height: 400px;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
box-shadow: 4px 13px 30px 1px rgba(252, 56, 56, 0.2);
border-radius: 10px;
transform: translateX(-80px);
overflow: hidden;
}
.info-container__img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
opacity: 100;
border-radius: 10px;
}
.info-container__content {
padding-right: 25px;
}
.info-container__content>* {
opacity: 100;
}
.info-container__title {
font-size: 24px;
font-weight: 700;
color: #0d0925;
margin-bottom: 20px;
}
.info-container__text {
color: #4e4a67;
margin-bottom: 30px;
line-height: 1.5em;
}
.info-container__button {
display: inline-flex;
background-image: linear-gradient(147deg, #5b0a6b 0%, #16034b 74%);
padding: 15px 35px;
border-radius: 50px;
color: #fff;
box-shadow: 0px 14px 80px rgba(0, 0, 0, 0.4);
text-decoration: none;
font-weight: 500;
justify-content: center;
text-align: center;
letter-spacing: 1px;
}
<div class="info-container">
<div class="info-container__img">
<img src="https://www.dmarge.com/wp-content/uploads/2021/01/dwayne-the-rock-.jpg">
</div>
<div class="info-container__content">
<div class="info-container__title">About Me</div>
<div class="info-container__text">This is fake info about a persons life.</div>
READ MORE
</div>
</div>
You set .info-container__img's width using pixels. Change that to percentages and it would act as you want. I set max-width: 400px and change width: 50% in respect to container's style.
#import url("https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600,700,800");
* {
box-sizing: border-box;
}
body {
background-color: #af39fe;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
min-height: 100vh;
font-family: "Fira Sans", sans-serif;
display: flex;
}
.info-container {
width: 95%;
position: relative;
max-width: 800px;
margin: auto;
background: #fff;
box-shadow: 0px 14px 80px rgba(34, 35, 58, 0.2);
padding: 25px;
border-radius: 10px;
height: auto;
}
.info-container__img {
width: 50%;
max-width: 400px;
flex-shrink: 0;
height: auto;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
box-shadow: 4px 13px 30px 1px rgba(252, 56, 56, 0.2);
border-radius: 10px;
transform: translateX(-80px);
overflow: hidden;
}
.info-container__img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
opacity: 100;
border-radius: 10px;
}
.info-container__content {
padding-right: 25px;
}
.info-container__content>* {
opacity: 100;
}
.info-container__title {
font-size: 24px;
font-weight: 700;
color: #0d0925;
margin-bottom: 20px;
}
.info-container__text {
color: #4e4a67;
margin-bottom: 30px;
line-height: 1.5em;
}
.info-container__button {
display: inline-flex;
background-image: linear-gradient(147deg, #5b0a6b 0%, #16034b 74%);
padding: 15px 35px;
border-radius: 50px;
color: #fff;
box-shadow: 0px 14px 80px rgba(0, 0, 0, 0.4);
text-decoration: none;
font-weight: 500;
justify-content: center;
text-align: center;
letter-spacing: 1px;
}
<div class="info-container">
<div class="info-container__img">
<img src="https://www.dmarge.com/wp-content/uploads/2021/01/dwayne-the-rock-.jpg">
</div>
<div class="info-container__content">
<div class="info-container__title">About Me</div>
<div class="info-container__text">This is fake info about a persons life.</div>
READ MORE
</div>
</div>
I'm a new to css and i really can't fix all as i want...
How can i align vertical the h1 to the start of user form?
but most important problem for me is that i can't center good the check and the link, i want it one below the other and centered in the div.
I'm not sure if i have positioned good the div but i want it centred but not too low on the page.
thanks to everyone!
body {
text-align: left;
background-image: url("img/lemon.jpg");
color: #1b1b1b;
}
input[type=text],
input[type=password]{
width: 65%;
display: table;
margin: 0 auto;
padding: 12px 20px;
border: none;
border-bottom: 1px solid darkgray;
background-color: #e9e9e9;
box-sizing: border-box;
margin-bottom: 7px;
resize: vertical;
}
h1 {
font-size: x-large;
}
h2 {
font-size: x-large;
}
button {
background-color: #4CAF50;
color: white;
padding: 7px 20px;
width: 65%;
height: 20%;
display: table;
margin: 0 auto;
border: none;
cursor: pointer;
background: linear-gradient(to bottom, #3d94f6 5%, #1e62d0 100%);
background-color: #3d94f6;
border: 1px solid #337fed;
cursor: pointer;
color: #ffffff;
font-size: 17px;
text-decoration: none;
text-shadow: -1px 1px 1px #1570cd;
}
button:hover {
background: linear-gradient(to bottom, #1e62d0 5%, #3d94f6 100%);
background-color: #1e62d0;
}
button:active {
position: relative;
top: 1px;
}
.container {
width: 35%;
height: auto;
margin-right: auto;
margin-left: auto;
margin-top: 7%;
background-color: white;
box-shadow: 2px 2px 11px rgb(11, 11, 11);
-webkit-box-shadow: 2px 2px 11px rgb(11, 11, 11);
-moz-box-shadow: 2px 2px 11px rgb(11, 11, 11);
overflow: hidden;
}
#check {
display:block;
margin-top: 7px;
}
span.frgt {
margin-top: 7px;
display: block;
}
a {
text-decoration: none;
color: #1e62d0;
}
img {
width: 100%;
height: auto;
opacity: 0.4;
}
<!DOCTYPE html>
<head>
</head>
<body>
<div class="container">
<h1>Login</h1>
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="password" name="psw" required>
<button type="submit">Login</button>
<hr>
<label id="check">
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
<span class="frgt">forgot password?</span>
</div>
</body>
</html>
If you set the h1 to the same width of the button and use "margin: 0 auto" to center it, this will make the h1 span the width of the button, and by default the text will be left aligned to the start of the button.
h1 {
font-size: x-large;
width: 65%;
margin: 0 auto;
}
I'm not too sure exactly what you want to do with the check section. If you use "text-align: center", this will center it, or use the same code as above to align it with the buttons.
you can use text-align: center; and vertical-align:top;
If your problem still exists, please explain more clearly what you want.
Use text-align: center; to center text within container.
To make it easier to align your elements, just wrap them into one div and adjust the div with CSS instead of dealing with each single element.
Here is an example of what you can do.
body {
text-align: left;
background-image: url("img/lemon.jpg");
color: #1b1b1b;
}
.form {
width: 75%;
margin: auto;
}
.form-bottom {
text-align: center;
}
input[type=text],
input[type=password] {
display: table;
margin: 0 auto;
width: 100%;
padding: 12px 20px;
border: none;
border-bottom: 1px solid darkgray;
background-color: #e9e9e9;
box-sizing: border-box;
margin-bottom: 7px;
resize: vertical;
}
h1 {
font-size: x-large;
}
h2 {
font-size: x-large;
}
button {
background-color: #4CAF50;
color: white;
padding: 7px 20px;
height: 20%;
width: 100%;
display: table;
margin: 0 auto;
border: none;
cursor: pointer;
background: linear-gradient(to bottom, #3d94f6 5%, #1e62d0 100%);
background-color: #3d94f6;
border: 1px solid #337fed;
cursor: pointer;
color: #ffffff;
font-size: 17px;
text-decoration: none;
text-shadow: -1px 1px 1px #1570cd;
}
button:hover {
background: linear-gradient(to bottom, #1e62d0 5%, #3d94f6 100%);
background-color: #1e62d0;
}
button:active {
position: relative;
top: 1px;
}
.container {
width: 35%;
height: auto;
margin-right: auto;
margin-left: auto;
margin-top: 7%;
background-color: white;
box-shadow: 2px 2px 11px rgb(11, 11, 11);
-webkit-box-shadow: 2px 2px 11px rgb(11, 11, 11);
-moz-box-shadow: 2px 2px 11px rgb(11, 11, 11);
overflow: hidden;
}
#check {
display: block;
margin-top: 7px;
}
span.frgt {
margin-top: 7px;
display: block;
}
a {
text-decoration: none;
color: #1e62d0;
}
img {
width: 100%;
height: auto;
opacity: 0.4;
}
<body>
<div class="container">
<div class="form">
<h1>Login</h1>
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="password" name="psw" required>
<button type="submit">Login</button>
</div>
<hr>
<div class="form-bottom">
<label id="check">
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
<span class="frgt">forgot password?</span>
</div>
</div>
</body>
So I've run into a CSS formatting question that I'm hoping I can get some help with. In general, I've got my setup working, having the position of the menu shift based on the size of the screen so that it is always centered vertically and horizontally, etc.
However, I've run into an issue where if you make the viewing window too small, elements begin to overlap, which is not desired.
Here is a fiddle to display what I am talking about. I would prefer that the green box force everything else below it, so it no longer overlaps the red one (Everything within the "buttonContainerBase" div):
Fiddle
Here's the HTML Div setup and relevant CSS:
#buttonContainerBase {
position: absolute;
left: 0px;
width: 100%;
height: 100%;
}
.hCenterDiv {
width: 370px;
margin-left: auto;
margin-right: auto;
}
.backgroundBoxDiv {
position: absolute;
top: 50%;
height: 244px;
margin-top: -112px;
margin-left: 0px;
width: 370px;
overflow: auto;
display: inline-block;
text-align: center;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
opacity: 0.95;
filter: alpha(opacity=95);
background: -moz-linear-gradient(top, #FFFFFF 45%, #F5F5F5 75%);
background: -webkit-gradient(linear, top, bottom, color-stop(45%, #FFFFFF), color-stop(75%, #F5F5F5));
background: linear-gradient(180deg, #FFFFFF 45%, #F5F5F5 75%);
box-shadow: 2px 2px 4px #244260;
}
.logoContainerDiv {
width: 344px;
height: 76px;
margin-top: 5px;
display: inline-block;
background-color: red;
}
.dividingLineDiv {
height: 2px;
width: 370px;
background-color: #335B84;
}
#myLogo {
position: absolute;
top: 5px;
left: 5px;
width: 257px;
height: 73px;
background-color: green;
}
#contentWrapper {
min-height: 300px;
}
.buttonContainerDiv {
/*padding: 5px;*/
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
}
#studentLoginDiv {
margin-bottom: 10px;
}
.customButton {
padding: 0px;
width: 225px;
height: 34px;
border: solid 2px #FFFFFF;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
border-style: outset;
background-color: #f5f5f5;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
cursor: pointer;
}
.customButton:hover {
border: solid 2px #F5F5F5;
border-style: inset;
background-color: #f2f2f2;
}
.customButton:active {
border: solid 4px #F5F5F5;
border-style: inset;
background-color: #D1D1D1;
}
<div id="contentWrapper">
<div id="buttonContainerBase">
<div class="hCenterDiv">
<div class="backgroundBoxDiv">
<div class="elementContainerDiv">
<div class="logoContainerDiv"></div>
<div class="dividingLineDiv"></div>
<div class="buttonContainerDiv">
<input class="customButton" id="instructorLogin" type="button" value="Instructor Login" onclick="window.open('http://www.google.com');" />
</div>
<div class="buttonContainerDiv" id="studentLoginDiv">
<input class="customButton" id="studentLogin" type="button" value="Student Login" onclick="window.open('http://www.google.com/');" />
</div>
<div class="dividingLineDiv"></div>
<div class="buttonContainerDiv">
<input class="customButton" id="instructionalVids" type="button" value="Instructional Videos" onclick="window.open('https://www.youtube.com/');" />
</div>
</div>
</div>
</div>
</div>
<div id="myLogo"></div>
</div>
Still kind of new to the CSS game, so I apologize in advance if things look funky/awkward.
This is happening because #myLogo has position:absolute, so :
change to position:relative in CSS
move the div in the DOM to be on the top
remove all CSS for #buttonContainerBase
In backgroundBoxDiv
remove margin-top: -112px, that would be somehow a hack.
add this code:
top: 0;
bottom:0;
right:0;
left:0;
margin:auto;
NOTE This will overlap in 320px view, so you might need media queries for that.
.hCenterDiv {
width: 370px;
margin-left: auto;
margin-right: auto;
}
.backgroundBoxDiv {
position: absolute;
top: 0;
bottom:0;
right:0;
left:0;
margin:auto;
height: 244px;
width: 370px;
overflow: auto;
display: inline-block;
text-align: center;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
/*
border: solid 2px #004586;
background-color: #FFFFFF;
*/
opacity: 0.95;
filter: alpha(opacity=95);
background: -moz-linear-gradient(top, #FFFFFF 45%, #F5F5F5 75%);
background: -webkit-gradient(linear, top, bottom, color-stop(45%, #FFFFFF), color-stop(75%, #F5F5F5));
background: linear-gradient(180deg, #FFFFFF 45%, #F5F5F5 75%);
box-shadow: 2px 2px 4px #244260;
}
.logoContainerDiv {
width: 344px;
height: 76px;
margin-top: 5px;
display: inline-block;
background-color: red;
/* border: solid 2px #004586; */
}
.dividingLineDiv {
height: 2px;
width: 370px;
background-color: #335B84;
}
#myLogo {
position: relative;
top: 5px;
left: 5px;
width: 257px;
height: 73px;
background-color: green;
}
#contentWrapper {
/*
column-count: 2;
column-gap: 40px;
*/
min-height: 300px;
}
/******** BUTTONS *********/
.buttonContainerDiv {
/*padding: 5px;*/
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
}
#studentLoginDiv {
margin-bottom: 10px;
}
.customButton {
padding: 0px;
width: 225px;
height: 34px;
border: solid 2px #FFFFFF;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
border-style: outset;
background-color: #f5f5f5;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
cursor: pointer;
}
.customButton:hover {
border: solid 2px #F5F5F5;
border-style: inset;
background-color: #f2f2f2;
}
.customButton:active {
border: solid 4px #F5F5F5;
border-style: inset;
background-color: #D1D1D1;
}
/****** END BUTTONS *******/
<div id="contentWrapper">
<div id="myLogo"></div>
<div id="buttonContainerBase">
<div class="hCenterDiv">
<div class="backgroundBoxDiv">
<div class="elementContainerDiv">
<div class="logoContainerDiv"></div>
<div class="dividingLineDiv"></div>
<div class="buttonContainerDiv">
<input class="customButton" id="instructorLogin" type="button" value="Instructor Login" onclick="window.open('http://www.google.com');" />
</div>
<div class="buttonContainerDiv" id="studentLoginDiv">
<input class="customButton" id="studentLogin" type="button" value="Student Login" onclick="window.open('http://www.google.com/');" />
</div>
<div class="dividingLineDiv"></div>
<div class="buttonContainerDiv">
<input class="customButton" id="instructionalVids" type="button" value="Instructional Videos" onclick="window.open('https://www.youtube.com/');" />
</div>
</div>
</div>
</div>
</div>
</div>
So I am having issues applying a border and a border background to a section of my page. I was wondering how I could do this, I've tried make two rows on the same line and apply a border to each but so far nothing I've tried has worked.
To simplify it: My page looks like this https://gyazo.com/ec14ae14dbb369c29759e48dff21cd52
When I need it to look like this https://gyazo.com/d18863ab12fde6cbe458406c6e0fc69a
HTML
<div class="container">
<div class="row">
<div class="col-md-4">
<div id="map-holder-image">
<img src="img/map-holder.png" class="img-responsive"/>
</div>
</div>
<form class="form" id="border">
<div class="form-group col-xs-4 col-md-4">
<label for="first-name" class="control-label">First Name</label>
<input type="text" class="form-control" id="first-name">
</div>
<div class="form-group col-xs-4 col-md-4">
<label for="email-address" class="control-label">Email</label>
<input type="email" class="form-control" id="email-address">
</div>
<br>
<div class="form-group col-xs-4 col-md-4">
<label for="last-name" class="control-label">Last Name</label>
<input type="text" class="form-control" id="last-name">
</div>
<div class="form-group col-xs-4 col-md-4">
<label for="confirm-email-address" class="control-label">Confirm Email</label>
<input type="email" class="form-control" id="confirm-email-address">
</div>
<div class="form-group col-xs-4 col-md-4" id="date-picker">
<label for="dates" class="control-label">Date of Birth</label>
<select class="date-dropdown" id="day-dropdown-form">
<script>
var daylist = "";
var i;
for (i = 1; i <= 31; i++) {
daylist += "<option>" + i + "</option>";
}
document.getElementById("day-dropdown-form").innerHTML = daylist;
</script>
</select>
<select id="month-dropdown-form">
<script>
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var monthlist = "";
var i;
for (i = 0; i < months.length; i++) {
monthlist += "<option>" + months[i] + "</option>";
}
document.getElementById("month-dropdown-form").innerHTML = monthlist;
</script>
</select>
<select class="date-dropdown" id="year-dropdown-form">
<script>
var yearlist = "";
var i;
for (i = 2016; i >= 1900; i--) {
yearlist += "<option>" + i + "</option>";
}
document.getElementById("year-dropdown-form").innerHTML = yearlist;
</script>
</select>
</div>
<div class="col-md-4" id="submit-button-col">
<button class="btn btn-info btn-lg" id="submit-button" type="button">
<h3>Submit</h3>
</button>
</div>
</form>
</div>
CSS
/*-- Bootstrap overrides instead of editing source LESS files --*/
h1, h2, h3, h4, h5, h6 {
font-family: 'Open Sans', sans-serif;
}
p, div {
font-family: 'Open Sans', sans-serif;
}
/*-- Custom Styling --*/
#logo {
padding: 10px;
}
#searchbox {
padding: 10px;
}
#search-input {
border: solid 1px gray;
border-radius: 8px;
background-color: #fff;
}
#search-input input {
border: 0;
box-shadow: none;
background: none;
}
#search-button {
padding: 8px;
}
#search-button button {
background: none;
border: none;
}
#login-name {
padding: 10px;
}
#login-name p {
text-align: center;
vertical-align: middle;
line-height: 50px;
float: right;
}
#settings-icon {
padding-top: 20px;
}
.navbar .navbar-inner {
padding: 0;
}
.navbar .nav {
margin: 0;
display: table;
width: 100%;
}
.navbar .nav li {
display: table-cell;
width: 11.1%;
float: none;
text-align: center;
left: 4px;
font-weight: bold;
}
.navbar .nav li a {
border-right: 1px solid black;
}
#active-link {
text-decoration: underline;
}
.navbar .nav li:first-child a {
border-left: 0;
border-radius: 3px 0 0 3px;
}
.navbar .nav li:last-child a {
border-right: 0;
border-radius: 0 3px 3px 0;
}
#detail-request {
text-align: center;
padding: 15px;
}
#banner-top-col {
width: 100%;
padding: 0;
}
#banner-bottom-col {
width: 100%;
padding: 0;
}
#banner-top {
margin: auto;
margin-bottom: 10px;
width: 100%;
height: 250px;
}
.banner-information {
position: absolute;
border: 5px solid #ff6600;
background-color: #ebebeb;
width: 400px;
height: 180px;
border-radius: 7px;
top: 12%;
text-align: center;
padding: 5px;
left: 5%;
}
.banner-information h4 {
font-size: 20px;
text-align: left;
padding-left: 5px;
padding-top: 15px;
}
.banner-information h1 {
font-size: 60px;
padding-left: 5px;
text-align: left;
font-weight: bold;
margin: 0;
}
#map-holder-image {
border: 2px solid #ff6600;
border-radius: 7px;
width: auto;
padding: 1px;
}
#email-address, #confirm-email-address, #first-name, #last-name {
width: 85%;
}
#contact-form-box {
border: 1px solid #ff6600;
width: auto;
background-color: #ebebeb;
border-radius: 7px;
}
.support-box {
border: 2px solid #ff6600;
background-color: #ebebeb;
border-radius: 7px;
text-align: center;
width: 359px;
margin-right: 18.5px;
margin-top: 10px;
display: inline-block;
right: 10px;
height: 230px;
}
.support-box h3 {
font-size: 25px;
text-align: center;
padding: 10px;
}
#support {
margin: 0 auto;
border: 0px solid #ffad41;
-webkit-border-radius: 16px;
-moz-border-radius: 16px;
border-radius: 16px;
font-size: 38px;
font-family: arial;
text-decoration: none;
display: inline-block;
text-shadow: 0px 0px 0 rgba(0, 0, 0, 0.3);
font-weight: bold;
color: #FFFFFF;
background-color: #ffc579;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffc579), to(#fb9d23));
background-image: -webkit-linear-gradient(top, #ffc579, #fb9d23);
background-image: -moz-linear-gradient(top, #ffc579, #fb9d23);
background-image: -ms-linear-gradient(top, #ffc579, #fb9d23);
background-image: -o-linear-gradient(top, #ffc579, #fb9d23);
background-image: linear-gradient(to bottom, #ffc579, #fb9d23);
filter: progid: DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#ffc579, endColorstr=#fb9d23);
text-align: center;
height: 80px;
width: 180px;
}
#support:hover {
border: 0px solid #ff9913;
background-color: #ffaf46;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffaf46), to(#e78404));
background-image: -webkit-linear-gradient(top, #ffaf46, #e78404);
background-image: -moz-linear-gradient(top, #ffaf46, #e78404);
background-image: -ms-linear-gradient(top, #ffaf46, #e78404);
background-image: -o-linear-gradient(top, #ffaf46, #e78404);
background-image: linear-gradient(to bottom, #ffaf46, #e78404);
filter: progid: DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#ffaf46, endColorstr=#e78404);
}
#support-image {
display: inline-block;
}
#support h3 {
display: inline-block;
padding: 0;
padding-right: 15px;
font-weight: 800;
margin: 0 auto;
}
.date-dropdown {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: url("../img/input-triangle.png") no-repeat white;
background-position: 50px center;
width: 80px;
height: 30px;
border: 1px solid #ddd;
background-size: 28px;
padding-left: 10px;
border-radius: 4px;
margin-top: 10px;
margin-right: 22px;
}
#date-picker {
height: 100px;
}
#month-dropdown-form {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: url("../img/input-triangle.png") no-repeat white;
background-position: 65px center;
width: 95px;
height: 30px;
border: 1px solid #ddd;
background-size: 28px;
padding-left: 10px;
border-radius: 4px;
margin-top: 10px;
margin-right: 22px;
}
#submit-button-col {
text-align: center;
margin: 0 auto;
height: 100px;
}
#submit-button {
margin: 0 auto;
margin-top: 25px;
border: 0px solid #46ec02;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
font-family: arial;
text-decoration: none;
display: inline-block;
text-shadow: 0px 0px 0 rgba(0, 0, 0, 0.3);
font-weight: bold;
color: #FFFFFF;
background-color: #46ec02;
background-image: -webkit-gradient(linear, left top, left bottom, from(#46ec02), to(#28c307));
background-image: -webkit-linear-gradient(top, #46ec02, #28c307);
background-image: -moz-linear-gradient(top, #46ec02, #28c307);
background-image: -ms-linear-gradient(top, #46ec02, #28c307);
background-image: -o-linear-gradient(top, #46ec02, #28c307);
background-image: linear-gradient(to bottom, #46ec02, #28c307);
filter: progid: DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#46ec02, endColorstr=#28c307);
text-align: center;
height: 65px;
width: 200px;
margin-right: 45px;
}
#submit-button h3 {
display: inline-block;
padding: 0;
text-align: center;
margin: 0 auto;
font-weight: 800;
}
#banner-bottom {
margin: auto;
width: 100%;
height: 250px;
padding-top: 15px;
}
#footer {
background-color: #363636;
height: 250px;
}
#footer p {
color: white;
text-align: center;
vertical-align: middle;
line-height: 130px;
}
#footer-line {
border: 1px solid white;
width: 95%;
}
Thanks a lot :)
Codepen example
In this case I'm wanting the image to be on the left then the authors name centered next to the image and then below those I'm trying to center the buttons. I had the picture and the buttons centered but when I add the authors name it all goes off.
Also how would I go about make everything a bit smaller. I've tried adjusting the height and width but then the author image ends up outside the section.
.authorbio {
background-color: #000;
border-radius: 10px;
border: 4px dotted #870505;
line-height: 50px;
width: 55%;
height: 55%;
margin: 0 0 10px 10px;
}
.authorbio>h1 {
vertical-align: right;
text-align: center;
}
.authorbio>img {
border: 1px solid #870505;
border-radius: 20px;
width: 150px;
height: 150px;
margin: 10px;
vertical-align: middle;
}
/* social links
--------------------------------------- */
a.sociallinks {
-webkit-border-radius: 5px 5px;
border: solid 1px rgb(0, 0, 0);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(76, 68, 68)), to(rgb(22, 21, 21)));
color: #ccc;
text-decoration: none;
text-align: center;
display: inline-block;
padding: 2px 2px;
font-size: 20px;
font-weight: bold;
}
a.sociallinks:hover {
-webkit-border-radius: 5px 5px;
border: solid 1px rgb(0, 0, 0);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(224, 0, 0)), to(rgb(61, 2, 2)));
color: #ccc;
text-decoration: none;
text-align: center;
display: inline-block;
padding: 2px 2px;
font-size: 20px;
font-weight: bold;
}
a.sociallinks:visited {
-webkit-border-radius: 5px 5px;
border: solid 1px rgb(0, 0, 0);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(96, 96, 96)), to(rgb(2, 2, 2)));
color: #000;
text-decoration: none;
text-align: center;
display: inline-block;
padding: 2px 2px;
font-size: 20px;
font-weight: bold;
}
a.sociallinks:active {
-webkit-border-radius: 5px 5px;
border: solid 1px rgb(0, 0, 0);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(30, 30, 30)), to(rgb(70, 70, 70)));
color: #ccc;
text-decoration: none;
text-align: center;
display: inline-block;
padding: 2px 2px;
font-size: 20px;
font-weight: bold;
}
<div class="authorbio">
<img src="https://images-na.ssl-images-amazon.com/images/I/61mO3gFua5L._UX250_.jpg" alt="Paula Cappa" />
<h1>Paula Cappa</h1>
<br /><a class="sociallinks" href="http://www.amazon.com/Greylock-Paula-Cappa-ebook/dp/B0168XVNZS/ref=cm_cr_pr_product_top?ie=UTF8" rel="nofollow" target="_blank" title="Greylock on Amazon">Amazon</a> <a class="sociallinks" href="http://www.facebook.com/paula.cappa.94"
target="_blank" title="Author Paula Cappa on Facebook">Facebook</a> <a class="sociallinks" href="https://www.goodreads.com/book/show/26887306-greylock" target="_blank" title="Greylock on Goodreads">Goodreads</a> <a class="sociallinks" href="https://www.smashwords.com/books/view/582884"
target="_blank" title="Greylock on Smashwords">Smashwords</a> <a class="sociallinks" href="https://twitter.com/PaulaCappa1" target="_blank" title="Paula Cappa Twitter">Twitter</a> <a class="sociallinks" href="https://paulacappa.wordpress.com/" target="_blank"
title="Paula Cappa Wordpress">Website</a>
</div>
try this one, you have only to replace image and link addresses.I wrote a full code for you.try this.if this is not the case tell me.
<!DOCTYPE html>
<html>
<head>
<title>hover</title>
<style type="text/css">
body{
margin:0;
padding:0;
}
div.bio{
width: 500px;
height: 400px;
margin: 1%;
padding: 10px;
background-color: black;
border: 3px dotted red;
border-radius: 5px;
}
div.autorimage{
width: 150px;
height: 150px;
border: 2px solid red;
box-shadow: 1px 2px 1px white;
border-radius: 5px;
}
div.autorimage img{
width: 100%;
height: 100%;
}
div.authorlink{
width: 100%;
text-align: center;
}
div.authorlink a{
font-size: 45px;
}
div.authorlink a:hover{
text-decoration: none;
color: red;
}
div.buttonsetone{
width: 100%;
}
div.buttonsettwo{
width: 100%;
margin-top: 50px;
}
div.buttonsetone div{
width: auto;
background-color: gray;
text-align: center;
float: left;
margin-left: 3%;
padding: 1%;
border: 1px solid white;
border-radius: 5px;
}
div.buttonsetone div:hover{
background-color: red;
}
div.buttonsetone div a{
text-decoration: none;
color: white;
font-size: 35px;
}
div.buttonsettwo div{
width: auto;
background-color: gray;
text-align: center;
float: left;
margin-left: 3%;
padding: 1%;
border: 1px solid white;
border-radius: 5px;
}
div.buttonsettwo div:hover{
background-color: red;
}
div.buttonsettwo div a{
text-decoration: none;
color: white;
font-size: 35px;
}
</style>
</head>
<body>
<div class="bio">
<div class="autorimage"><img src=""></div><br/>
<div class="authorlink">Paula Cappa</div><br/>
<div class="buttonsetone">
<div>Amazon</div>
<div>Facebook</div>
<div>Goodreads</div>
</div><br/>
<div class="buttonsettwo">
<div>Smashwords</div>
<div>Twitter</div>
<div>WebSite</div>
</div>
</div>
</body>
</html>
Check this working
Codepen example
I just made the title inline-block and adjusted the width accordingly with the useful calc property.
.authorbio>h1{
vertical-align: right;
text-align: center;
display: inline-block;
width: calc(100% - 175px); /* substract the image's width + some extra */
}
Then put the links inside a container to apply some flex properties (justify-content: center did the magic).
<div class="sociallinks-container">
<!-- put your links here -->
...
</div>
.sociallinks-container {
display: flex;
flex-wrap: nowrap; /* this prevents the items wrapping to another line */
justify-content: center; /* this centers the links */
}