Use CSS to keep elements from overlapping based on height - html

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>

Related

Can't Get Rid Of 8px Margin

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>

Border behind Button slight below position CSS

I m trying to implement below button CSS, I tried to used box-shadow as well psuedo code i.e before after still not getting the output I wanted.
the button that I wanted:
my code:
.et_pb_button {
background-color: #f16922!important;
width: 65%;
outline: 3px solid #f16922;
outline-offset: 10px;
text-transform: uppercase;
font-size: 14px!important;
}
Button
Please see below snippet:
button {
position: relative;
display: inline-block;
vertical-align: top;
background-color: blue;
color: #fff;
border-radius: none;
text-transform: uppercase;
border: none;
padding: 10px 12px;
}
button::after {
content: '';
position: absolute;
top: 5px;
left: -5px;
right: -5px;
bottom: -5px;
border: 1px solid red;
display: block;
z-index: -1;
}
<button>View Project</button>
.btngroup button{
background-color: rgb(29, 174, 236);
border: 0;
padding: 10px 15px;
font-size: 15px;
color: white;
width: 150px;
height: 50px;
text-transform: uppercase
}
.btngroup .drop{
width: 165px;
height: 50px;
border: 1.5px solid red;
margin-top: -42.5px;
}
<center>
<div class="btngroup">
<button>view project</button>
<div class="drop"></div>
</div>
</center>
Here is an idea with one element and multiple background and border-image:
.button {
display:inline-block;
padding:10px 60px 20px;
margin:10px;
color:#fff;
border:2px solid transparent;
border-image:linear-gradient(to bottom,transparent 10px,red 0) 2;
background:
linear-gradient(blue,blue) top center/calc(100% - 20px) calc(100% - 10px),
linear-gradient(red,red) 0 8px /100% 2px;
background-repeat:no-repeat;
}
<span class="button">Button</span>
And with CSS variable to easily control the whole shape:
.button {
--t:10px; /* Distance of the border from the top*/
--p:10px; /* Distance between the border and background*/
--b:2; /* Thickness of the border (unitless to be used with slice)*/
--c:red; /* border color*/
display:inline-block;
padding:var(--p) 60px calc(2*var(--p));
margin:10px;
color:#fff;
border:calc(1px*var(--b)) solid transparent;
border-image:linear-gradient(to bottom,transparent var(--t),var(--c) 0) var(--b);
background:
linear-gradient(blue,blue) top center/calc(100% - 2*var(--p)) calc(100% - var(--p)),
linear-gradient(var(--c),var(--c)) 0 calc(var(--t) - 1px*var(--b))/100% calc(1px*var(--b));
background-repeat:no-repeat;
}
<span class="button">Button</span>
<span class="button" style="--c:green;--t:15px;--p:8px;--b:3;">Button</span>
<span class="button" style="--c:#000;--t:25px;--p:15px;--b:1;">Button</span>
Here's an alternative based on Hanif's suggestion, which uses both pseudo-elements instead of one with a negative z-index. For some backgrounds (e.g. an image or gradient), it might be necessary to adjust the background-position for the ::after
button {
position: relative;
display: inline-block;
vertical-align: top;
background-color: blue;
color: #fff;
border-radius: none;
text-transform: uppercase;
border: none;
padding: 10px 12px;
}
button::before {
content: '';
position: absolute;
top: 5px;
left: -5px;
right: -5px;
bottom: -5px;
border: 1px solid red;
display: block;
}
button::after {
content: '';
position: absolute;
top: 5px;
left: 0;
right: 0;
height: 1px;
background: inherit;
display: block;
}
<button>View Project</button>

How to make this specific shadow for a box : before?

How can i achieve the top left part of this box like the image below with css?
I can't make the shadow below the yellow triangle.
some suggestions would be helpfull.
Below is my CSS + HTML so far:
:root {
--jaune: #FFF701;
--bleu: #212D55;
}
.book{
margin-bottom: 0px;
font-size: x-small;
color: #364165;
text-align: center;
}
.box {
border: 1px solid var(--bleu);
background-color: #fff;
position: relative;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 16px;
}
.box::before {
content: ' ';
border-top: 32px solid #d3d5dd;
border-right: 30px solid var(--jaune);
width: 0;
position: absolute;
}
.btn_book{
background-color: #212d55;
width: 128px;
margin-right:79px;
margin-left:79px;
border: 1px solid #212d55;
position: absolute;
color: white;
text-transform: uppercase;
cursor: pointer;
}
.btn_book:hover{
background-color: var(--jaune);
color:#212d55;
}
.btn_book:hover::before {
border-top: 10px solid #212d55;
}
.btn_book:before {
content: "";
height: 0;
width: 0;
border-top: 10px solid #fffa0a;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
position: absolute;
z-index: 1;
top:0;
left: 0;
transform-origin: left;
transform: translate(60%) translateY(-71%) rotate(135deg)
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box" style="width: 18rem; height: 19rem;">
<img src="https://b2btolink.com/leboudoir/wp-content/themes/leboudoir/images/logo.png" style="width: 100px; margin-left:80px;">
<p style="text-align:center;color: #212d55;">
<b>NEW CANAAN</b>
</p>
<hr class="dashed">
<p class="book"> 160 Main Street</p>
<p class="book"> New Canaan CT 06840</p>
<p class="book"> 203-957-8600</p>
<hr class="dashed">
<button type="button" class="btn_book">BOOK NOW</button>
</div>
How can this be possible with shadow property
Here is an idea using multiple background with gradient and skew transformation:
.box {
border: 1px solid #212D55;
background-color: #fff;
position: relative;
margin: 10px;
background:
linear-gradient(to top left,transparent 50%,#d3d5dd 50%) top left/32px 32px no-repeat;
}
.box::before {
content: ' ';
position: absolute;
top:-1px;
left:-1px;
width:34px;
height:34px;
background:
linear-gradient(to bottom right,transparent 45%,grey 50%) bottom/100% 5px,
linear-gradient(to bottom right,transparent 45%,grey 50%) right/5px 100%,
linear-gradient(to bottom right,transparent 50%,yellow 50%);
background-repeat: no-repeat;
transform: skew(5deg,5deg);
}
<div class="box" style="width: 18rem; height: 19rem;">
</div>
You will need to adjust this a little, but you should be able to use clip-pathto create a triangle on another div, then change the z-index on your ::before to bring it in front of the triangle.
:root {
--jaune: #FFF701;
--bleu: #212D55;
}
.book{
margin-bottom: 0px;
font-size: x-small;
color: #364165;
text-align: center;
}
.box {
border: 1px solid var(--bleu);
background-color: #fff;
position: relative;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 16px;
}
.box::before {
content: ' ';
border-top: 32px solid #d3d5dd;
border-right: 30px solid var(--jaune);
width: 0;
position: absolute;
z-index: 100;
}
.shadow{
position: absolute;
top: 5px;
height: 41px;
left: 0px;
width: 37px;
background: #A0A0A0;
clip-path: polygon(83% 0%, 4% 63%, 100% 91%);
z-index: 1;
}
.btn_book{
background-color: #212d55;
width: 128px;
margin-right:79px;
margin-left:79px;
border: 1px solid #212d55;
position: absolute;
color: white;
text-transform: uppercase;
cursor: pointer;
}
.btn_book:hover{
background-color: var(--jaune);
color:#212d55;
}
.btn_book:hover::before {
border-top: 10px solid #212d55;
}
.btn_book:before {
content: "";
height: 0;
width: 0;
border-top: 10px solid #fffa0a;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
position: absolute;
z-index: 1;
top:0;
left: 0;
transform-origin: left;
transform: translate(60%) translateY(-71%) rotate(135deg)
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box" style="width: 18rem; height: 19rem;">
<div class="shadow"></div>
<img src="https://b2btolink.com/leboudoir/wp-content/themes/leboudoir/images/logo.png" style="width: 100px; margin-left:80px;">
<p style="text-align:center;color: #212d55;">
<b>NEW CANAAN</b>
</p>
<hr class="dashed">
<p class="book"> 160 Main Street</p>
<p class="book"> New Canaan CT 06840</p>
<p class="book"> 203-957-8600</p>
<hr class="dashed">
<button type="button" class="btn_book">BOOK NOW</button>
</div>

Having trouble aligning an image with link and text via html and css

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 */
}

css works properly only in chrome

i am trying to design a page by CSS , the problem is when i am trying to show my page on browsers otherthan Google Chrome , it doesn't work, it shows me wrecked design page, the design only works perfectly on chrome , i used code prefixer to make my css3 code match all browsers .
here is my code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>anaawez</title>
</head>
<style>
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
height: 97%;
background-image: url(bg.jpg);
background-repeat-x: repeat;
background-repeat-y: no-repeat;
background-attachment: initial;
background-position-x: initial;
background-position-y: initial; /*background-origin*/
-webkit-background-origin: initial;
-moz-background-origin: initial;
background-origin: initial; /*background-clip*/
-webkit-background-clip: initial;
background-color: #718693;
}
#wrapper {
background: white;
border: 1px solid #000;
margin: auto;
margin-top: 10px;
font: 1.5em arial, verdana, sans-serif;
width: 960px;
height: 100%%; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
#header {
height: 8%;
background-color: white;
font-family: verdana;
font-size: 15px;
margin: 10px; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 10px;
}
#headerleft {
text-align: left;
vertical-align: top;
float: left;
}
#headerright {
text-align: right;
float: right;
}
#search {
height: 5%;
text-align: center;
}
#container {
height: 50%;
text-align: right;
font-family: verdana;
font-size: 15px;
margin: 10px; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 0px;
}
#blockcontainer {
height: 80%;
}
#blockouterleft {
float: left;
width: 65%;
height: 39%;
margin-top: 5px; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
#blockinnerleftleft {
float: left;
width: 45%;
height: 100%;
background-color: #FDFDFD; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: thin dotted #999;
height: 100% vertical-align: middle;
}
#blockinnerleftmiddle {
float: right;
width: 45%;
height: 100%;
background-color: #FDFDFD; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: thin dotted #999;
}
#blockouterright {
float: right;
width: 35%;
height: 39%;
margin-top: 5px; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
#blockinnerrightleft {
float: right;
width: 84.1%;
height: 100%;
background-color: #FDFDFD; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: thin dotted #999;
}
#tagcloud {
height: 18%;
background-image: -webkit-linear-gradient(bottom, rgb(17,28,46) 13%, rgb(13,21,26) 66%);
background-image: -moz-linear-gradient(bottom, rgb(17,28,46) 13%, rgb(13,21,26) 66%);
background-image: -o-linear-gradient(bottom, rgb(17,28,46) 13%, rgb(13,21,26) 66%);
background-image: -ms-linear-gradient(bottom, rgb(17,28,46) 13%, rgb(13,21,26) 66%);
background-image: linear-gradient(bottom, rgb(17,28,46) 13%, rgb(13,21,26) 66%);
-image-image background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0.13, rgb(17,28,46)), color-stop(0.66, rgb(13,21,26)) );
text-align: right;
font-family: verdana;
font-size: 15px; /*border-radius*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 10px;
margin: 10px;
}
#contenttext {
margin: 3px;
font-size: 10px;
height: 100%;
}
#image {
float: left;
margin: 3px;
font-size: 10px;
height: 100%;
}
</style>
<body >
<div id="wrapper">
<div id="header" >
<div id="headerright">Login with Facebook | Contact Us| Help </div>
<div id="headerleft"><img src="anaawez.png" /></div>
</div>
<div id="search">
<form>
<label>ANA AWEZ</label>
<input type="text" />
<select name="type">
<option name="work" value="work">work</option>
</select>
<input type="button" value="submit" />
</form>
</div>
<div id="container">
<div id="blockcontainer">
<div id="blockouterleft">
<div id="blockinnerleftleft">
<div >
<div id="image" ><p ><img src="dta2.png" align="left" height="90px" width="90px"/></p></div></div>
<div id="contenttext">i want you to spread my shitty facebook application , please i need to steal your data ASAP ! :D view ad</div>
</div>
<div id="blockinnerleftmiddle"></div>
</div>
<div id="blockouterright">
<div id="blockinnerrightleft"></div>
</div>
<div id="blockouterleft">
<div id="blockinnerleftleft"></div>
<div id="blockinnerleftmiddle"></div>
</div>
<div id="blockouterright">
<div id="blockinnerrightleft"></div>
</div>
<div id="blockouterleft">
<div id="blockinnerleftleft"></div>
<div id="blockinnerleftmiddle"></div>
</div>
<div id="blockouterright">
<div id="blockinnerrightleft"></div>
</div>
</div>
</div>
<div id="tagcloud">BlackBerry IPHONE 4GS SAMSUNG GALAXY SII MIDO BADER JOB PROGRAMMER </div>
<div id="bottom"></div>
</div>
</body>
</html>
JS Fiddle reproduction of the above HTML/CSS.
In #wrapper you have height specified as 100%%.
Changing that to 100% appears to fix most of the issues.