CSS Body width not working on every web page - html

I am relatively new to CSS and I am creating a web application with a number of web pages that I want centered across all web pages. I have created a CSS style sheet where I set the width to 60% and text-align to be centered. On the index page the document in centered but when I hit a link the next page is always the full width of the screen.
I attached some of the code below;
Thanks for the help...
CSS Style sheet
/*
Document : affablebean
Created on : Jun 9, 2010, 3:59:32 PM
Author : tgiunipero
Description: Style rules for the AffableBean application
*/
/* html tags */
body {
font-family: Arial, Helvetica, sans-serif;
width: 60%;
text-align: center;
margin: 20px auto;
}
hr {
border: 0;
background-color: #333;
height: 1px;
margin: 0 25px;
width: 300px;
}
table {
margin: 0 20px;
border-spacing: 0;
text-align: center;
border: solid 1px #f5eabe;
}
/* general styles */
#main { background: #eee }
#singleColumn {
margin: 20px 30px;
text-align: left;
}
.lightBlue { background-color: #edf8f7 }
.white { background-color: #fff }
.bubble {
font-weight: bold;
background-color: #f5eabe;
padding: 5px;
color: inherit;
}
.hMargin { margin: 0 30px }
.smallText { font-size: small }
.header {
background-color: #c3e3e0;
height: 30px;
}
/* styles for elements contained in the header, i.e.,
shopping cart widget, language toggle, and logo */
#header {
height: 250px;
background: #aaa;
}
#logo {
height: 155px;
width: 155px;
float: left;
margin-left: 30px;
margin-top: -20px;
}
#logoText {
float: left;
margin: 20px 0 0 70px;
/* font styles apply to text within img alt attribute */
font-family: 'American Typewriter', Courier, monospace;
font-size: 50px;
color: #333;
}
#widgetBar {
height: 50px;
width: 850px;
float: right;
background: #ccc;
}
.headerWidget {
width: 194px;
margin: 20px 2px;
font-size: small;
float: right;
line-height: 25px;
background: #aaa;
}
/* footer styles */
#footer {
height: 60px;
width: 350px;
clear: left;
background: #aaa;
}
/* index page styles */
#indexLeftColumn {
height: 400px;
width: 350px;
float: left;
background: #ccc;
}
#indexRightColumn {
height: 400px;
width: 500px;
float: left;
background: #eee;
}
.categoryBox {
height: 176px;
width: 212px;
margin: 21px 14px 6px;
float: inherit;
background: #ccc;
}
.categoryLabelText {
line-height: 150%;
font-size: x-large;
}
/* category page styles */
#categoryLeftColumn {
width: 185px;
float: left;
margin-top: 25px;
padding-left: 15px;
}
#categoryRightColumn {
margin-top: 10px;
width: 650px;
float: left;
}
.categoryButton {
margin: 15px 22px;
padding: 13px;
display: block;
background-color: #d3ede8;
}
#selectedCategory {
background-color: #b2d2d2;
margin-left: 10px;
width: 139px;
}
#categoryTitle {
margin: -34px 180px 0 0;
font-size: x-large;
float: right;
background-color: #f5eabe;
padding: 7px;
}
.categoryText {
line-height: 25px;
font-size: x-large;
}
#productTable { width: 600px }
#productTable tr { height: 90px }
#productTable td { width: 145px }
/* cart page styles */
#actionBar {
margin: 30px;
width: 750px;
text-align: center;
}
#subtotal { margin: 40px 0 20px 430px }
#cartTable { width: 750px }
#cartTable td {
width: 145px;
height: 90px;
}
/* checkout page styles */
#checkoutTable {
width: 360px;
background-color: #f5eabe;
float: left;
height: 280px;
}
#infoBox {
width: 300px;
padding-left: 30px;
float: left;
}
#priceBox {
padding: 10px;
margin: 10px 0;
height: 128px;
background-color: #c3e3e0;
}
/* confirmation page styles */
#confirmationText {
margin: 0 20px 20px;
padding: 10px;
background-color: #f5eabe;
float: left;
width:540px;
}
.summaryColumn {
margin-top: 15px;
width: 50%;
float: left;
}
#orderSummaryTable {
width: 100%;
text-align: left;
height: 200px;
}
#deliveryAddressTable {
width: 70%;
margin-left: 15%;
text-align: left;
height: 200px;
}
Index Page
<ui:composition template="/layout/abMainTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="head">
<link rel="stylesheet" type="text/css" href="css/affablebean.css"></link>
<title>The Affable Bean</title>
</ui:define>
<ui:define name="content">
<div id="main">
<div id="header">
<div id="widgetBar">
<div class="headerWidget">
[ language toggle ]
</div>
<div class="headerWidget">
[ shopping cart widget ]
</div>
</div>
<a href="#">
<img src="#" id="logo" alt="Affable Bean logo"></img>
</a>
<img src="#" id="logoText" alt="the affable bean"></img>
</div>
<div id="indexLeftColumn">
<div id="welcomText">
<p>[ welcome text ]</p>
</div>
</div>
<div id="indexRightColumn">
<div class="categoryBox">
<a href="category.xhtml">
<span class="categoryLabelText">dairy</span>
</a>
</div>
<div class="categoryBox">
<a href="cart.xhtml">
<span class="categoryLabelText">meats</span>
</a>
</div>
<div class="categoryBox">
<a href="checkout.xhtml">
<span class="categoryLabelText">bakery</span>
</a>
</div>
<div class="categoryBox">
<a href="confirmation.xhtml">
<span class="categoryLabelText">fruit and veg</span>
</a>
</div>
</div>
<div id="footer">
<hr>
<p id="footerText">[ footer text ]</p>
</hr>
</div>
</div>
</ui:define>
</ui:composition>
Category Page
<ui:composition template="/layout/abMainTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="head">
<link rel="stylesheet" type="text/css" href="css/affablebean.css"></link>
<title>The Affable Bean</title>
</ui:define>
<ui:define name="content">
<div id="main">
<div id="header">
<div id="widgetBar">
<div class="headerWidget">
[ language toggle ]
</div>
<div class="headerWidget">
[ checkout button ]
</div>
<div class="headerWidget">
[ shopping cart widget ]
</div>
</div>
<a href="#">
<img src="#" id="logo" alt="Affable Bean logo"></img>
</a>
<img src="#" id="logoText" alt="the affable bean"></img>
</div>
<div id="categoryLeftColumn">
<div id="selectedCategory">
<a href="#" class="categoryButton">
<span class="categoryText">dairy</span>
</a>
<a href="#" class="categoryButton">
<span class="categoryText">meats</span>
</a>
<a href="#" class="categoryButton">
<span class="categoryText">bakery</span>
</a>
<a href="#" class="categoryButton">
<span class="categoryText">fruit and veg</span>
</a>
</div>
</div>
<div id="categoryRightColumn">
<p id="categoryTitle">[ selected category ]</p>
<table id="productTable">
<tr>
<td class="lightBlue">
<img src="#" alt="product image"></img>
</td>
<td class="lightBlue">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="lightBlue">[ price ]</td>
<td class="lightBlue">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
<tr>
<td class="white">
<img src="#" alt="product image"></img>
</td>
<td class="white">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="white">[ price ]</td>
<td class="white">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
<tr>
<td class="lightBlue">
<img src="#" alt="product image"></img>
</td>
<td class="lightBlue">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="lightBlue">[ price ]</td>
<td class="lightBlue">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
<tr>
<td class="white">
<img src="#" alt="product image"></img>
</td>
<td class="white">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="white">[ price ]</td>
<td class="white">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
</table>
</div>
<div id="footer">
footer
</div>
</div>
</ui:define>
</ui:composition>
And the template page
<?xml version='1.0' encoding='UTF-8' ?>
<!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"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<ui:insert name="head"></ui:insert>
</h:head>
<h:body>
<ui:insert name="content" ></ui:insert>
</h:body>
</html>

the body element resides inside the html element, and if you want to set any element's width in percent, you should first define it's parent element's width.
html {
padding:0;
margin:0;
width:100%; /* 100% of window with, so the body width of 60% will work as expected */
}

You have to use position: relative or position: absolute command.

Related

When I inspect the code, why does the layout break?

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text.html" charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Website</title>
<style>
body {
margin: 0;
}
#container {
width: 100%;
}
#headerBg {
width: 100%;
background-color: #ffffff;
}
#interior {
width: 100%;
margin: 0 auto;
}
#header {
width: 100%;
height: 85px;
}
#logo {
width: 200px;
height: 45px;
float: left;
display: inline-block;
margin-left: 40px;
margin-top: 40px;
}
#topNav {
width: 600px;
float: right !important;
color: #000000;
margin-right: 40px;
}
.topNavFont {
font-size:18px;
float: right;
font-family:sans-serif;
}
.social_youtube {
margin-right: 10px;
}
.social_facebook {
margin-right: 10px;
}
.social_twitter {
margin-right: 10px;
}
.searchbar {
width: 150px;
height: 30px;
margin-right: 40px;
font-size: 16px;
}
.button {
width: 130px;
height: 36px;
margin-right: 40px;
}
#bottomNav {
width: 870px;
float: right !important;
color: #000000;
margin-right: 40px;
margin-top: 10px;
}
.bottomNavFont {
font-size:1em;
color:#222;
float: right;
font-family:sans-serif;
}
.bottombutton {
width: 130px;
height: 35px;
}
#row {
margin-top: 30px;
}
img.team {
width: 1355px;
height: 650px;
margin-left: 45px;
margin-top: 5px;
}
img.leftarrow {
float: left;
width: 50px;
height: 50px;
margin-left: 40px;
margin-top: 55px;
}
div.pic {
width: 1450px;
}
img.lake {
margin-left: 30px;
}
img.battersea {
margin-left: 25px;
}
p.location {
display: inline-block;
margin-top: 5px;
margin-left: 20px;
padding-right: 100px;
}
p.battersea {
margin-left: 150px;
}
img.rightarrow {
width: 50px;
height: 50px;
margin-left: 15px;
margin-bottom: 70px;
}
#rows {
margin-top: 30px;
width: 1450px;
}
p.subtext {
display: inline-block;
width: 340px;
padding-right: 30px;
padding-left: 30px;
text-align: center;
margin-left: 20px;
margin-top: 5px;
}
p.juniors {
margin-left: 110px;
}
img.youth {
margin-left: 120px;
width: 383px;
}
img.regatta {
margin-left: 30px;
width: 383px;
}
img.rowathon {
margin-left: 32px;
width: 383px;
}
#story {
float: right;
width: 340px;
height: 300px;
margin-right: 150px;
margin-top: 50px;
}
#storytext {
margin-left: 115px;
margin-top: 50px;
height: 330px;
width: 1000px;
}
p.subheading {
width: 590px;
font-size: 19px;
font-weight: 600;
}
p.copy {
width: 790px;
height: 230px;
}
#footer {
margin-top: 70px;
height: 140px;
background-color: #0645be;
color: white;
font-size: 20px;
}
#leftside {
float: left;
margin-left: 45px;
text-align: left;
}
#rightside {
float: right;
margin-right: 35px;
text-align: right;
}
</style>
</head>
<body>
<div id="container">
<div id="headerBg">
<div id="interior">
<div id="header">
<div id="logo">
<img src="https://www.britishrowing.org/wp-content/themes/britishrowing/assets/img/brand/br-logo-horizontal.png" height="45" alt="logo">
</div>
<div id="topNav">
<img class="topNavFont social social_instagram" src="https://instagram-brand.com/wp-content/uploads/2016/11/Instagram_AppIcon_Aug2017.png?w=300" alt="instagram logo" width="37" height="36">
<img class="topNavFont social social_youtube" src="http://pluspng.com/img-png/youtube-png-youtube-play-button-png-free-download-396.png" alt="youtube logo" width="40" height="35">
<img class="topNavFont social social_facebook" src="https://s18955.pcdn.co/wp-content/uploads/2017/11/Facebook-share-icon.png" alt="facebook logo" width="37" height="35">
<img class="topNavFont social social_twitter" src="http://stagewp.sharethis.com/wp-content/uploads/2019/03/twitterimg.png" alt="twitter logo" width="37" height="35">
<form class="topNavFont"><input class="searchbar" value="Search..."></form>
<button class="topNavFont button">SIGN IN</button>
</div>
<div id="bottomNav">
<button class="bottomNavFont bottombutton shop">SHOP</button>
<button class="bottomNavFont bottombutton events">EVENTS</button>
<button class="bottomNavFont bottombutton news">NEWS</button>
<button class="bottomNavFont bottombutton go">GO ROWING</button>
<button class="bottomNavFont bottombutton about">ABOUT US</button>
<button class="bottomNavFont bottombutton home">HOME</button>
</div>
</div> <!-- closing header tag here -->
<!---------------------------->
<!-- end header code here ---->
<!---------------------------->
<div id="content">
<img class="team" src="https://www.britishrowing.org/wp-content/uploads/2017/02/Paralympics_11_09_16_1235-e1486995505416.jpg" width="1340" height="570">
</div>
<div id="row">
<img class="leftarrow" src="https://image.flaticon.com/icons/png/512/21/21256.png" width="50" height="50">
<div class="pic">
<img class="lake battersea" src="https://media.timeout.com/images/102759833/630/472/image.jpg" width="175" height="170" alt="Battersea Park">
<img class="lake" src="https://leytonstonelondone11.files.wordpress.com/2011/10/hollow-pond-boats.jpg" width="175" height="170" alt="Hollow Pond">
<img class="lake" src="https://media-cdn.tripadvisor.com/media/photo-s/04/0d/dc/b6/boating-pond.jpg" width="175" height="170" alt="Dulwich Park">
<img class="lake" src="http://www.utrc.org.uk/wp-content/uploads/2014/01/MensEight2012-for-ROWING-SQUADS-ABOUT.jpg" width="175" height="170" alt="Upper Thames">
<img class="lake" src="https://upload.wikimedia.org/wikipedia/commons/9/99/Regent%27s_Park_boating_lake_-_geograph.org.uk_-_21750.jpg" width="175" height="170" alt="Regents Park">
<img class="lake" src="https://i.pinimg.com/originals/57/63/cc/5763cc9831846834b8af799f748841c3.jpg" width="175" height="170" alt="Hyde Park">
<img class="rightarrow" src="https://image.flaticon.com/icons/png/512/20/20659.png" width="50" height="50">
<br>
<p class="location battersea">Battersea Park</p>
<p class="location hollow">Hollow Pond</p>
<p class="location dulwich">Dulwich Park</p>
<p class="location upper">Upper Thames</p>
<p class="location regents">Regents Park</p>
<p class="location hyde">Hyde Park</p>
</div>
</div>
<div id="rows">
<img class="youth" src="https://www.britishrowing.org/wp-content/uploads/2019/12/9-FRBC.png" alt="Youth Rowing Project" width="383">
<img class="regatta" src="https://www.britishrowing.org/wp-content/uploads/2019/07/England-Junior-Women-HIR2019.jpg" alt="International Womens Regatta" width="383">
<img class="rowathon" src="https://www.britishrowing.org/wp-content/uploads/2019/11/Ian-Jamieson-1600x900.jpg" alt="Charity Rowathon" width="383">
<br>
<p class="subtext juniors">Community-Focused Clubs Enables More Juniors to Reap the Benefits of Rowing</p>
<p class="subtext">Transformed Regatta Allows Cutting Edge International Rowing Competition</p>
<p class="subtext">Community-Focused Clubs Enables More Juniors to Reap the Benefits of Rowing</p>
</div>
<div id="story">
<img src="https://www.britishrowing.org/wp-content/uploads/2019/12/Shelagh-Allen.jpg" alt="Mary" width="375" height="300">
</div>
<div id="storytext">
<p class="subheading">Success for the older generation groups at the Mizuno British Indoor Rowing Championships</p>
<p class="copy">
Another keep fit enthusiast, who set herself the challenge of racing over 2000m, was Shelagh Allen. The 81-year-old, from West Byfleet in Surrey, was the oldest woman taking part in the Championships and the only competitor in the women’s 80-84 age group.
The former nurse, who finished in 10.42, took up indoor rowing at 58 and has since competed in many events, including the World Indoor Rowing Championships, and has held several British records.
She said: “I used to cycle but then tried indoor rowing and loved it.
I used to go five days a week but now go about three.
As long as I keep going I will keep doing it.
So many people say they are proud of me, which is great.”<br><br>
Her next major event will be the World Rowing Indoor Championships in Paris in February.<br>
In the meantime, the mother-of-two and grandmother-of-one will continue to go to the gym and power walk for an hour every morning with her husband Tom, 85.
The sprightly seniors impressed GB’s top para-rowers, who were also competing at the indoor championships, as part of the selection process for the Paralympics in Tokyo next year.
</p>
</div>
<div id="footer">
<div id="leftside">
<p>British Rowing, 6 Lower Mall, Hammersmith, London, W6 9DJ</p>
<p>Telephone: 020 8237 6700</p>
<p>Fax: 020 8237 6749</p>
</div>
<div id="rightside">
<p>Accessibility Statement</p>
<p>Privacy Policy and Cookies Policy</p>
<p>© Copyright 2019 British Rowing</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
As you would see, the header section, the story section and the footer section breaks. The main content in the middle seems to have elongated, so I'm not exactly sure on how to fix this. I have tried to decrease the width of the images, to see if that would fix the problem, however, when I exit from 'inspect code' it makes the images 'lessen' in width and does not fit with the rest of the content on the page.
This is the fourth attempt, after having other parts of the site break.
i think you should use css grid or flex box if you do not you can decrease size of sections like #row and images and use Percentage (%) for the values of the properties

Is there a way to center the item in the middle of the layout

I am trying to center an item in the middle of the layout while also, if possible have ability to control its position if need be with minor css tweaks. In my layout page I cannot figure out why the item I want in the middle of the screen both horizontally and vertically is positioned to the left of the screen. I know the issue is something in my layout I just can't seem to find out what the issue is. Below is a basic version of my layout with the item I can trying to center.
* {
margin: 0;
padding: 0;
}
html, body {
width:100%;
height:100%;
margin:0;
}
.layoutPage {
min-height: 95%;
}
/***********************************
************Header*****************
***********************************/
.headerImage {
background: blue;
padding: 1.75em;
margin: 0;
padding: 0;
background-color: blue;
height: 3.5em; /*4em*/
}
/***********************************
***************Body****************
***********************************/
.bodyContainer {
overflow: auto;
padding-bottom: 1em;
font-family: Verdana;
font-size: 12px; /*12px*/
}
.appRoundedShadow {
display: inline-block;
height: auto
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
</head>
<body>
<div class="layoutPage">
<div class="headerImage">
</div>
<br />
<div class="bodyContainer">
<div class="appRoundedShadow">
<div class="container">
<div style="width: 450px; margin: 0 auto; border: 1px solid;">
<div style="margin: 2px; border-bottom-style: solid; border-bottom-width: thin; background-color: blue; text-align: center;">
<span style="font-weight: bold; font-size: 19px; color: #fff">Report</span>
</div>
<div style="margin: 1em">
<span style=""><input type="text" name="year"><br></span>
<input type="submit" id="executeReport" name="SubmitBtn" class="submitButton" value="Execute Report"/>
</div>
<div style="margin-left: 1em">
<p>It may take 2 or more minutes to complete your request.<br/></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr />
<span class="footerText">Copyright © </span>
</div>
</body>
</html>
I want to center the entire appRoundedShadow div
You've got to do a couple things here. First, remove the <br> that's currently below the .headerImage div, because it's adding extra space that makes the .headerImage appear like it's not centered vertically.
Then, add the following for .appRoundedShadow:
.appRoundedShadow {
display: block;
height: auto;
margin: auto;
}
Then, make the padding consistent around .bodyContainer (replace it's padding-bottom with padding).
Finally, remove the min-height on the .layoutPage. Let the div's contents determine the height instead.
* {
margin: 0;
padding: 0;
}
html, body {
width:100%;
height:100%;
margin:0;
}
/***********************************
************Header*****************
***********************************/
.headerImage {
background: blue;
padding: 1.75em;
margin: 0;
padding: 0;
background-color: blue;
height: 3.5em; /*4em*/
}
/***********************************
***************Body****************
***********************************/
.bodyContainer {
overflow: auto;
padding: 1em;
font-family: Verdana;
font-size: 12px; /*12px*/
position: relative;
}
.appRoundedShadow {
display: block;
height: auto;
margin: auto;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
</head>
<body>
<div class="layoutPage">
<div class="headerImage">
</div>
<div class="bodyContainer">
<div class="appRoundedShadow">
<div class="container">
<div style="width: 450px; margin: 0 auto; border: 1px solid;">
<div style="margin: 2px; border-bottom-style: solid; border-bottom-width: thin; background-color: blue; text-align: center;">
<span style="font-weight: bold; font-size: 19px; color: #fff">Report</span>
</div>
<div style="margin: 1em">
<span style=""><input type="text" name="year"><br></span>
<input type="submit" id="executeReport" name="SubmitBtn" class="submitButton" value="Execute Report"/>
</div>
<div style="margin-left: 1em">
<p>It may take 2 or more minutes to complete your request.<br/></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr />
<span class="footerText">Copyright © </span>
</div>
</body>
</html>
To center your report add this style...
.bodyContainer {
text-align: center;
}
You can give the element you wish to center 'display:block' and 'margin:auto'
* {
margin: 0;
padding: 0;
}
html, body {
width:100%;
height:100%;
margin:0;
}
.layoutPage {
min-height: 95%;
}
/***********************************
************Header*****************
***********************************/
.headerImage {
background: blue;
padding: 1.75em;
margin: 0;
padding: 0;
background-color: blue;
height: 3.5em; /*4em*/
}
/***********************************
***************Body****************
***********************************/
.bodyContainer {
overflow: auto;
padding-bottom: 1em;
font-family: Verdana;
font-size: 12px; /*12px*/
}
.appRoundedShadow {
display: block;
height: auto;
margin:auto;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
</head>
<body>
<div class="layoutPage">
<div class="headerImage">
</div>
<br />
<div class="bodyContainer">
<div class="appRoundedShadow">
<div class="container">
<div style="width: 450px; margin: 0 auto; border: 1px solid;">
<div style="margin: 2px; border-bottom-style: solid; border-bottom-width: thin; background-color: blue; text-align: center;">
<span style="font-weight: bold; font-size: 19px; color: #fff">Report</span>
</div>
<div style="margin: 1em">
<span style=""><input type="text" name="year"><br></span>
<input type="submit" id="executeReport" name="SubmitBtn" class="submitButton" value="Execute Report"/>
</div>
<div style="margin-left: 1em">
<p>It may take 2 or more minutes to complete your request.<br/></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr />
<span class="footerText">Copyright © </span>
</div>
</body>
</html>
Take display: inline-block off .appRoundedShadow and you're done.

aligning an image and a gallery next to one another

I am trying to position the "selected" hero on the right to be aligned with the gallery of heroes to the left so I can add information and a button below the selected hero later on. This page is only missing a paragraph of text that will go below both the gallery; The selected hero and a confirmation button that will go under the hero portrait on the right. Would it be easier to contain all of it in one huge section? Or am I making this too complicated?
var d = new Date();
document.getElementById("practice").innerHTML = d.toDateString();
body {
background-color: lightsteelblue;
margin: 0;
}
h1 {
text-align: center;
font-weight: bold;
font-size: 70px;
text-shadow: 3px 3px grey;
}
.time{
position: absolute;
top: 100%;
right: 0;
}
.navbar {
overflow:hidden;
background-color: black;
}
.navbar a{
float: left;
display: block;
color: White;
text-align: center;
padding: 10px 10px;
font-size: 20px;
text-decoration: none;
}
.navbar a:hover{
background-color: white;
color: black;
}
.navbar a:active {
background-color: grey;
color: white;
}
.navbar input[type=text] {
float: right;
padding: 6px;
border: none;
margin-top: 8px;
margin-right: 12px;
}
#heroList{
width: 1000px;
margin: 0 50px;
margin-top: 200px;
}
.heroes{
margin: 5px;
border: 1px solid black;
width: 180px;
float: left;
}
.heroNames{
padding: 10px;
text-align: center;
color: white;
font-weight: bold;
background-color:black;
}
.heroes img{
width: 175px;
height: 175px;
}
#chosenHero{
width: auto;
margin: 0 50px;
margin-top: 50px;
}
.myHero{
border: 1px solid black;
width: 180px;
float: right;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="navbar">
Home
<a class="active" href="hero.html">Hero</a>
About
<input type="text" placeholder="Search..">
</div>
<h1>CHOOSE YOUR HERO</h1>
<!--Hero table goes here(10 heroes, 2x5)-->
<div id="heroList">
<!--Hero portraits go here(outlined, not selectable)-->
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/0/06/Heroes_Valter_Sprite_%283%2A%29.png/revision/latest?cb=20180427060005"><div class="heroNames"><a>Valter</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/6/65/Heroes_Walhart_Sprite_%283%2A%29.png/revision/latest?cb=20180811070849"><div class="heroNames"><a>Walhart</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/b/bc/Heroes_Zelgius_Sprite.png/revision/latest?cb=20180527163939"><div class="heroNames"><a>Zelgius</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/7/71/Heroes_Roy_Sprite_%283%2A%29.png/revision/latest?cb=20180512034742"><div class="heroNames"><a>Roy</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/8/8b/Heroes_Arvis_Sprite.png/revision/latest?cb=20180428141625"><div class="heroNames"><a>Arvis</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/5/51/Heroes_Cordelia_Sprite_%283%2A_%26_4%2A%29.png/revision/latest?cb=20180605063103"><div class="heroNames"><a>Cordelia</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/8/85/Heroes_Peri_Sprite_%283%2A%29.png/revision/latest?cb=20180612160011"><div class="heroNames"><a>Peri</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/0/04/Heroes_Effie_Sprite_%283%2A%29.png/revision/latest?cb=20180612034721"><div class="heroNames"><a>Effie</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/5/53/Heroes_Anna_Sprite_%28Default%29.png/revision/latest?cb=20180614160859"><div class="heroNames"><a>Anna</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/a/a5/Heroes_Ishtar_Sprite.png/revision/latest?cb=20180511072816"><div class="heroNames"><a>Ishtar</a></div>
</div>
</div>
<!--The chosen Hero goes here(selectable)-->
<div id="chosenHero">
<div class="myHero"><img src="https://vignette.wikia.nocookie.net/fireemblem/images/a/a5/Heroes_Ishtar_Sprite.png/revision/latest?cb=20180511072816"><div class="heroNames"><a>Ishtar</a></div>
</div>
</div>
<!--Button for confirmation goes here-->
</div>
<p id="practice" class="time"></p>
<script type="text/javascript" src="practice.js"></script>
</body>
</html>
If you cannot use grid system, try following CSS modifications:
var d = new Date();
document.getElementById("practice").innerHTML = d.toDateString();
body {
background-color: lightsteelblue;
margin: 0;
}
h1 {
text-align: center;
font-weight: bold;
font-size: 70px;
text-shadow: 3px 3px grey;
}
.time {
position: absolute;
top: 100%;
right: 0;
}
.navbar {
overflow: hidden;
background-color: black;
}
.navbar a {
float: left;
display: block;
color: White;
text-align: center;
padding: 10px 10px;
font-size: 20px;
text-decoration: none;
}
.navbar a:hover {
background-color: white;
color: black;
}
.navbar a:active {
background-color: grey;
color: white;
}
.navbar input[type=text] {
float: right;
padding: 6px;
border: none;
margin-top: 8px;
margin-right: 12px;
}
.navbar:after {
clear: both;
content: "";
display: block;
}
#heroList {
width: calc(100% - 200px);
float: left;
}
.heroes {
margin: 5px;
border: 1px solid black;
width: 180px;
float: left;
}
.heroNames {
padding: 10px;
text-align: center;
color: white;
font-weight: bold;
background-color: black;
}
.heroes img {
width: 175px;
height: 175px;
}
#chosenHero {
width: 200px;
float: left;
}
.myHero {
border: 1px solid black;
width: 180px;
float: right;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="navbar">
Home
<a class="active" href="hero.html">Hero</a>
About
<input type="text" placeholder="Search..">
</div>
<h1>CHOOSE YOUR HERO</h1>
<!--Hero table goes here(10 heroes, 2x5)-->
<div id="heroList">
<!--Hero portraits go here(outlined, not selectable)-->
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/0/06/Heroes_Valter_Sprite_%283%2A%29.png/revision/latest?cb=20180427060005"><div class="heroNames"><a>Valter</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/6/65/Heroes_Walhart_Sprite_%283%2A%29.png/revision/latest?cb=20180811070849"><div class="heroNames"><a>Walhart</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/b/bc/Heroes_Zelgius_Sprite.png/revision/latest?cb=20180527163939"><div class="heroNames"><a>Zelgius</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/7/71/Heroes_Roy_Sprite_%283%2A%29.png/revision/latest?cb=20180512034742"><div class="heroNames"><a>Roy</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/8/8b/Heroes_Arvis_Sprite.png/revision/latest?cb=20180428141625"><div class="heroNames"><a>Arvis</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/5/51/Heroes_Cordelia_Sprite_%283%2A_%26_4%2A%29.png/revision/latest?cb=20180605063103"><div class="heroNames"><a>Cordelia</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/8/85/Heroes_Peri_Sprite_%283%2A%29.png/revision/latest?cb=20180612160011"><div class="heroNames"><a>Peri</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/0/04/Heroes_Effie_Sprite_%283%2A%29.png/revision/latest?cb=20180612034721"><div class="heroNames"><a>Effie</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/5/53/Heroes_Anna_Sprite_%28Default%29.png/revision/latest?cb=20180614160859"><div class="heroNames"><a>Anna</a></div>
</div>
<div class="heroes">
<img src="https://vignette.wikia.nocookie.net/fireemblem/images/a/a5/Heroes_Ishtar_Sprite.png/revision/latest?cb=20180511072816"><div class="heroNames"><a>Ishtar</a></div>
</div>
</div>
<!--The chosen Hero goes here(selectable)-->
<div id="chosenHero">
<div class="myHero"><img src="https://vignette.wikia.nocookie.net/fireemblem/images/a/a5/Heroes_Ishtar_Sprite.png/revision/latest?cb=20180511072816"><div class="heroNames"><a>Ishtar</a></div>
</div>
</div>
<!--Button for confirmation goes here-->
</div>
<p id="practice" class="time"></p>
<script type="text/javascript" src="practice.js"></script>
</body>
</html>
This would be the proper way of doing it.
https://i.imgur.com/xIm2fbV.png

text under the image goes at the top of the other images?

So I am making this little game, where you need drag text under the images.
I need to make little tabs under the images where the text is needed to be dragged onto.
I thought of placing a div around the image, and another div in the div for the tab, in css I styled the tab to be 25px in height. but the 25px, isn't going under the image in the same div, it's above the other images in that row..
this is what I see, http://prntscr.com/9yv7m8
the red space is the tab, that needs to go under the pictures..
How can I fix this properly?
This is my code,
CSS
body, html {
margin-left: 10%;
margin-right: 10%;
padding: 0px;
height: 100%;
font-family: georgia, "Comic Sans MS";
background-color: #f0f0f0;
}
header {
height: 5%;
border-bottom: thick solid grey;
}
footer {
height: 5%;
border-top: thick solid grey;
}
.points {
float: right;
}
.container {
width: 100%;
height: 90%;
}
.plaatje {
width: 100px;
height: 100px;
}
.plaatje2 {
float: left;
width: 25%;
}
.igen {
font-size: 25px;
font-weight: bold;
}
.sprint {
float: right;
}
.copyright {
position: relative;
bottom: 20px;
left: 65px;
font-size: 10px;
}
.img {
width: 25%;
height: 25%;
float: left;
}
.img2 {
width: 25%;
height: 25%;
float: left;
}
.answer {
height: 25px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Words</title>
<link rel="stylesheet" href="css/style.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<script>
</script>
</head>
<body>
<header>
<span class="fa fa-refresh" style="font-size:25px;"></span><span class="igen"> igen</span>
<span class="points"><i class="fa fa-thumbs-o-up" style="font-size:24px"></i>Rigtige: 0 <i class="fa fa-thumbs-o-down" style="font-size:24px"></i>Forkerte: 0</span>
</header>
<div class="container">
<div>
<img class="img" src="img/cat.jpg" alt="cat" />
<div class="answer">
</div>
</div>
<img class="img" src="img/beak.jpg" alt="beak" />
<img class="img" src="img/spoon.jpg" alt="spoon" />
<img class="img" src="img/milk.jpg" alt="milk" />
<img class="img2" src="img/egg.jpg" alt="egg" />
<img class="img2" src="img/thee.jpg" alt="tea" />
<img class="img2" src="img/meel.jpg" alt="meel" />
<img class="img2" src="img/passport.jpg" alt="passport" />
</div>
<footer>
<img class="dansk" id="dansk" src="img/dansk2.jpg" alt="dansk" />
<img class="sprint" id="sprint" src="img/sprint2.png" alt="sprint" />
<center><span class="copyright"> ©2013 laerdansk / FC-Sprint² Leerbedrijf bronnen </span></center>
</footer>
</body>
</html>
I'm not sure is this you looking for...
<html>
<title>test</title>
<head>
</head>
<body>
<style>
.top{background-color: #900; width: 100%; height: 100px;}
.middle{background-color: #090; width: 100%; height: 600px; float: left;}
.sidebar{background-color: #ccc; width: 10%; height: 600px; float: left;}
.container{background-color: #000; width: 90%; height: 600px; float: left;}
.row{background-color: #fff; width: 100%; height: 100px; float: left;}
.footer{background-color: #090; width: 100%; height: 100px; float: left;}
.slice{background-color: #069; width: 33%; height: 100px; float: left;}
</style>
<div class="top">top</div>
<div class="middle">
<div class="sidebar">sidebar</div>
<div class="container">
<div class="row">
<div class="slice">1</div>
<div class="slice">2</div>
<div class="slice">3</div>
</div>
<div class="row">
<div class="slice">1</div>
<div class="slice">2</div>
<div class="slice">3</div>
</div>
<div class="row">
<div class="slice">1</div>
<div class="slice">2</div>
<div class="slice">3</div>
</div>
</div>
</div>
<div class="footer">
footer
</div>
</body>
</html>

Layout Messing Up When I Add Text

Well, I have a problem. I have my layout exactly as I want it, but when I add text in, the layout changes. It's kind of hard to explain, so I'm going to show pictures.
Layout Before Text:
Layout After Text:
Any help is greatly appreciated
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.header {
color: #AEC6CF;
font-family: gabriola;
font-weight: 900;
font-size: 50px;
position: relative;
}
/* ID */
#row1 {
width: 100%;
height: 15%;
}
#row2 {
width: 100%;
height: 2.5%;
}
#row3 {
width: 100%;
height: 70%;
}
#row4 {
width: 100%;
height: 2.5%;
}
#row5 {
width: 100%;
height: 9.7%;
}
#column1 {
border-bottom: 3px solid black;
border-right: 3px solid black;
width: 20%;
height: 100%;
left: 0;
display: inline-block;
margin-right: -0.25%;
}
#column2 {
border-bottom: 3px solid black;
border-left: 3px solid black;
width: 79%;
height: 100%;
right: 0;
display: inline-block;
margin-left: -0.25%;
}
/* Misc. */
.center {
text-align: center;
}
.right {
text-align: right;
}
.left {
text-align: left;
}
.clearfix {
float: clear;
margin: 0;
padding: 0;
}
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<link type="text/css" rel="stylesheet" href="stylesheet.css">
<title>Test</title>
</head>
<body>
<div id="row1">
<div id="column1" class="clearfix">
</div>
<div id="column2" class="clearfix">
<h1 class="header center">See The Problem?</h1>
</div>
</div>
<div id="row2">
<div id="column1" class="clearfix">
</div>
<div id="column2" class="clearfix">
</div>
</div>
<div id="row3">
<span id="column1" class="clearfix">
</span>
<span id="column2" class="clearfix">
</span>
</div>
<div id="row4">
<span id="column1" class="clearfix">
</span>
<span id="column2" class="clearfix">
</span>
</div>
<div id="row5">
<div id="column1" class="clearfix" style="border-bottom: 0px;">
</div>
<div id="column2" class="clearfix" style="border-bottom: 0px;">
</div>
</div>
</body>
</html>