I am trying to make a button go underneath a div, however, the button float to the left instead of floating to the right. I am trying to achieve something like this:
So far this is what have:
HTML:
<div class="container">
<div class="main">
<div class="sectiontitle">
<h1 class="maintitle">Free Pick-Up<br>and Delivery</h1>
</div>
<div class="sectiondes">
<p class="maintext"> We offer a free pick up and delivery service to your home or place of work.</p>
</div>
<div class="sectionbutton">
<button href="#!" class="button">learn more</button>
</div>
</div>
</div>
CSS:
.container {
margin-right: auto;
margin-left: auto;
margin-bottom:0px;
}
.main{
margin-top: 100px;
background: url("../img/Home-img.jpg");
height: 931.5px;
width: 1920px;
float: right;
}
.maintitle{
font-family: 'Roboto', sans-serif;
font-weight: 500;
font-size: 65px;
color: #000;
letter-spacing: 2px;
line-height: 60px;
height: 120px;
width: 641.6px;
margin-top: 121px;
margin-right: 392.4px;
margin-left: 886px;
margin-bottom: 30px;
text-align: right;
}
.maintext{
height: 68px;
width: 489.6px;
margin-right: 392.4px;
text-align: right;
float: right;
font-size: 24px;
color: #000;
letter-spacing: 0;
line-height: 34px;
margin-top:0px;
font-family: 'Roboto', sans-serif;
font-weight: 400;
margin-bottom: 30px;
}
.sectionbutton{
float: right;
}
button{
background-color: #1B325F;
font-family: 'Roboto', sans-serif;
font-weight: 700;
border: none;
padding: 13px 28.5px 13px 29px;
float: right;
text-align: center;
text-decoration: none;
border-radius: 2px;
margin-bottom: 20px;
text-transform: uppercase;
font-size: 18px;
color: #ffffff;
letter-spacing: -0.03px;
margin-right: 392.4px;
}
I know for a fact the problem is my CSS but I don't know how to make the button go underneath the other div. The codepen is https://codepen.io/mrsalami/pen/Yxpyop
.container {
margin-right: auto;
margin-left: auto;
margin-bottom:0px;
}
.main{
margin-top: 100px;
background: url("../img/Home-img.jpg");
height: 931.5px;
width: 1920px;
float: right;
}
.maintitle{
font-family: 'Roboto', sans-serif;
font-weight: 500;
font-size: 65px;
color: #000;
letter-spacing: 2px;
line-height: 60px;
height: 120px;
width: 641.6px;
margin-top: 121px;
margin-right: 392.4px;
margin-left: 886px;
margin-bottom: 30px;
text-align: right;
}
.maintext{
height: 68px;
width: 489.6px;
margin-right: 392.4px;
text-align: right;
float: right;
font-size: 24px;
color: #000;
letter-spacing: 0;
line-height: 34px;
margin-top:0px;
font-family: 'Roboto', sans-serif;
font-weight: 400;
margin-bottom: 30px;
}
.sectionbutton{
clear: both;
float: right;
}
button{
background-color: #1B325F;
font-family: 'Roboto', sans-serif;
font-weight: 700;
border: none;
padding: 13px 28.5px 13px 29px;
float: right;
text-align: center;
text-decoration: none;
border-radius: 2px;
margin-bottom: 20px;
text-transform: uppercase;
font-size: 18px;
color: #ffffff;
letter-spacing: -0.03px;
margin-right: 392.4px;
}
<div class="container">
<div class="main">
<div class="sectiontitle">
<h1 class="maintitle">Free Pick-Up<br>and Delivery</h1>
</div>
<div class="sectiondes">
<p class="maintext"> We offer a free pick up and delivery service to your home or place of work.</p>
</div>
<div class="sectionbutton">
<button href="#!" class="button">learn more</button>
</div>
</div>
</div>
Related
<style>
.new-title {
font-family: arial;
text-align: center;
color: orange;
font-weight: bold;
font-size: 15px;
margin-bottom: 5px;
}
.macbook-title {
font-family: arial;
font-size: 20px;
font-weight: bold;
text-align: center;
margin-top: 0;
margin-bottom: 5px;
}
.supercharge-title {
font-family: arial;
font-size: 35px;
text-align: center;
font-weight: bold;
margin-top: 0;
margin-bottom: 0;
}
.price-title {
font-family: arial;
font-size: 15px;
text-align: center;
margin-top: 10px;
font-weight: 5px;
margin-bottom: 15px;
}
.buy-title {
background-color: blue;
color: white;
margin-left: 1000px;
padding-left: 15px;
padding-right: 15px;
padding-top: 5px;
padding-bottom: 5px;
border-radius: 20px;
}
</style>
<p class="new-title">New</p>
<p class="macbook-title">MacBook Pro</p>
<p class="supercharge-title">Supercharged for pros</p>
<p class="price-title">From $1999</p>
<p>
<span class="buy-title">Buy</span>>
</p>
New
MacBook Pro
Supercharged for pros
From $1999
Buy>
I approached it like the rest of my code, with text-align: center; but for some reason it doesn't move like my other text does, I've also tried margining but that doesn't seem like an efficient way to do it.
change your .buy-title to this. Live Demo Here
.buy-title {
display:block;
background-color: blue;
color: white;
margin: 0px auto;
padding-left: 15px;
padding-right: 15px;
padding-top: 5px;
padding-bottom: 5px;
border-radius: 20px;
width: fit-content;
}
There are many ways to do so, But I suggest as you are very new to CSS you must go with CSS Flex. It will definetely boost your CSS skills.
You can see the snippet below how simple it is.
Refer this to learn more about flex: https://www.w3schools.com/css/css3_flexbox.asp
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.new-title {
font-family: arial;
text-align: center;
color: orange;
font-weight: bold;
font-size: 15px;
margin-bottom: 5px;
}
.macbook-title {
font-family: arial;
font-size: 20px;
font-weight: bold;
text-align: center;
margin-top: 0;
margin-bottom: 5px;
}
.supercharge-title {
font-family: arial;
font-size: 35px;
text-align: center;
font-weight: bold;
margin-top: 0;
margin-bottom: 0;
}
.price-title {
font-family: arial;
font-size: 15px;
text-align: center;
margin-top: 10px;
font-weight: 5px;
margin-bottom: 15px;
}
.buy-title {
background-color: blue;
color: white;
padding-left: 15px;
padding-right: 15px;
padding-top: 5px;
padding-bottom: 5px;
border-radius: 20px;
}
<div class="container">
<p class="new-title">New</p>
<p class="macbook-title">MacBook Pro</p>
<p class="supercharge-title">Supercharged for pros</p>
<p class="price-title">From $1999</p>
<p>
<span class="buy-title">Buy</span>
</p>
</div>
I have a div container with some text in it, and a back button. I want the text to be at the top of the div and the back button to be at the bottom of the div. How do I do this? Jsfiddle example of it
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
}
#view_back_button {
vertical-align: bottom;
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
Is it useful for you? I just added position: relative; to your container and then used absolute,left,right and bottom to locate it.
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
position: relative;
}
#view_back_button {
vertical-align: bottom;
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
#view_button {
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin-bottom: 50px;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
Archive by revise some css code like below:
#view {
position: relative; /* add */
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
}
#view_button { /* add */
position: absolute;
bottom: 30px;
width: 100%;
}
#view_back_button {
/* vertical-align: bottom; */
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
position: relative;
}
#view_back_button {
vertical-align: bottom;
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
margin-bottom: 20px;
}
#view_button {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
added position: relative to parent container and css for view_button
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin:auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
position:relative; /* added */
}
/* added*/
#view_button {
position: absolute;
bottom:10px;
width:100%;
}
#view_back_button {
/* removed vertical-align */
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
So basically, I want to have 3 lines of text next to a <div>, like this (photoshop mockup):
This is my structure so far:
.gd-content .gd-c-match.in-match .gd-c-match-tutorial {
margin-top: -5px;
width: 100%;
height: 99px;
background-color: rgba(0, 0, 0, 0.66);
padding-top: 24px;
padding-bottom: 18px;
text-align: center;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section {
height: 57px;
width: 290px;
text-align: left;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .title {
display: inline-block;
color: white;
font-size: 16px;
font-weight: 600;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .title .subtitle {
display: block;
font-weight: 400;
color: #494949;
font-size: 14px;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .gd-c-tutorial-square {
display: inline-block;
text-align: center;
padding-top: 19px;
padding-right: 3px;
line-height: 17px;
font-family: 'Uni Sans';
font-weight: bold;
font-size: 24px;
color: white;
height: 100%;
width: 57px;
background-image: url('../../img/gd_content_match_tutorial_square.png');
}
<div class="gd-content">
<div class="gd-c-match in-match">
<div class="gd-c-match-tutorial">
<div class="gd-c-tutorial-section">
<div class="gd-c-tutorial-square">1</div><span class="title">Contact Opponent
<span class="subtitle">Add the other player</span></span>
</div>
</div>
</div>
</div>
And it works... for 2 lines.
But as soon as I get a linebreak (because of the text being too long - which is supposed to happen) it just breaks the whole thing:
Any suggestions on what to do?
Set the width of .title to 70%
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .title {
display: inline-block;
color: white;
font-size: 16px;
font-weight: 600;
width:70%;
}
Hope this helps..Tested by me..
.gd-content .gd-c-match.in-match .gd-c-match-tutorial {
margin-top: -5px;
width: 100%;
height: 99px;
background-color: rgba(0, 0, 0, 0.66);
padding-top: 24px;
padding-bottom: 18px;
text-align: center;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section {
height: 57px;
width: 290px;
text-align: left;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .title {
display: inline-block;
color: white;
font-size: 16px;
font-weight: 600;
width:70%;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .title .subtitle {
display: block;
font-weight: 400;
color: #494949;
font-size: 14px;
}
.gd-content .gd-c-match.in-match .gd-c-match-tutorial .gd-c-tutorial-section .gd-c-tutorial-square {
display: inline-block;
text-align: center;
padding-top: 19px;
padding-right: 3px;
line-height: 17px;
font-family: 'Uni Sans';
font-weight: bold;
font-size: 24px;
color: white;
float: left;
height: 100%;
width: 57px;
background-image: url('../../img/gd_content_match_tutorial_square.png');
}
<div class="gd-content">
<div class="gd-c-match in-match">
<div class="gd-c-match-tutorial">
<div class="gd-c-tutorial-section">
<div class="gd-c-tutorial-square">1</div><span class="title">Contact Opponent
<span class="subtitle">Add the other player ingame and form a party</span></span>
</div>
</div>
</div>
</div>
I tried to make an alignment for a FAQ page. but I face a problem that my questions and answers are also aligned in the center, but I want the title be in the center and everything to be aligned in the center but not the text.
I want it to appear like this
HTML:
<html>
<head>
<meta name="keywords" content="Photos, Images, Designs, HD, Tutorials, Photoshop, Download, Free, Upload, Gallery">
<meta name="description" content="Free HD Photos and Free tutorials For Photoshop and Designs.">
<meta charset="UTF-8">
<title>FAQ</title>
<link rel="shortcut icon" href="Images/Icon.ico">
<link href='Css/Style2.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="header">
<img src="Images/Logo.png" alt="Logo"/>
<div id="menu">
<ul>
<li><img class="nav-icons" src="Images/Nav-icons/home.png" alt="home" /> Home</li>
<li><img class="nav-icons" src="Images/Nav-icons/tutorials.png" alt="tutorials" /> Tutorials</li>
<li><img class="nav-icons" src="Images/Nav-icons/gallery.png" alt="gallery" /> Gallery</li>
<li class="active"><img class="nav-icons" src="Images/Nav-icons/faq.png" alt="faq" /> FAQ</li>
<li><img class="nav-icons" src="Images/Nav-icons/contact.png" alt="contact" /> Contact Us</li>
<li><img class="nav-icons" src="Images/Nav-icons/about.png" alt="about" /> About Us</li>
<li><img class="nav-icons" src="Images/Nav-icons/user.png" alt="sign up" /> Sign Up</li>
<li><img class="nav-icons" src="Images/Nav-icons/login.png" alt="login" /> Login</li>
</ul>
</div>
</div>
<div id="line"></div>
<br>
<div id="content">
<h1>FAQ</h1>
<img src="Images/faq.jpg" alt="FAQ" />
<dl>
<dt>What is Creative Designs about ?</dt>
<dd>Creative Designs is a website specialising in Photography and Designs. It offers people a look at creative Photos and Designs.</dd>
<dt>How much does it cost to register on Creative Designs ?</dt>
<dd>It's totally free.</dd>
<dt>Who can see the photos I upload ?</dt>
<dd>Any one can see your photos because its public by default you can share it on Facebook or any social website.</dd>
<dt>Where did the idea come from ?</dt>
<dd>We all want our memories to be immortal we love to show our sons and grandsons in the future our beautiful memories so we made this website to make it possible.</dd>
<dt>Where does the name came from ?</dt>
<dd>As humans we like imagining beautiful things, We Love Creativity that nature always provides in its landscapes, so Its Creative Designs</dd>
<dt>How Can I make an Advertisement on Creative Designs ?</dt>
<dd>For all advertising enquiries, please email Advertising#CreativeDesigns.com</dd>
<dt>How to report a technical Issue On Creative Designs ?</dt>
<dd>For technical issues, please email Support#CreativeDesigns.com</dd>
<dt>How to contact Creative Designs ?</dt>
<dd>You can go to the Contact Us Page</dd>
</dl>
</div>
<br>
<br>
<div id="line"></div>
<div id="footers">
<div id="footer">
<div id="footerbox">
<header>Keep In Touch</header>
<p>
Please keep in touch with us and follow our social networks to keep updated about everything.
</p>
<img class="Social" src="Images/facebook500.png" alt="Facebook" />
<img class="Social" src="Images/twitter.png" alt="Twitter" />
<img class="Social" src="Images/instagram.png" alt="Instagram" />
<img class="Social" src="Images/behance.png" alt="Behance" />
</div>
<div id="footerbox2">
<header>Navigate</header>
<br>
Home Tutorials <br><br>
Gallery FAQ <br><br>
Contact Us About Us
</div>
<div id="footerbox3">
<header>Subscribe</header>
<br>
Subscribe to our newsletter. If you are interested just put your Email address here.
<br>
<br>
<input type="text" size="30" placeholder="E-mail address"/> <a class="go" href="#">Go</a>
<br>
</div>
</div>
</div>
<div id="copyright">
<p>Copyright © 2014. Creative Designs all rights reserved. <a class="imp" href="Terms.html">Terms of Use</a>.</p>
</div>
</body>
</html>
CSS:
body {
background-color: #ccc;
margin: 0px;
font-family: Helvetica, sans-serif;
font-size: 13px;
}
a{
text-decoration: none;
}
input{
-webkit-border-radius: 5px;
padding: 4px 7px;
border-color: #3fb8e8;
}
.imp{
font-weight:bold;
text-decoration: underline;
}
textarea{
-webkit-border-radius: 6px;
padding: 4px 7px;
border-color: #3fb8e8;
}
iframe{
width:560px;
height:315px;
border: 0px;
}
.ex{
color: #3fb8e8;
}
.gallery{
padding:0px 190px;
}
.gallery td {
padding: 30px;
text-align: left;
font-size: 15px;
font-weight: bold;
}
.gallery img{
width:250px;
height:250px;
border:3px solid #000000;
}
.gallery .download{
width:95px;
height:30px;
border:0px;
}
.tutorials{
padding:0px 200px;
}
.tutorials td {
padding: 5px;
text-align: left;
font-size: 15px;
font-weight: bold;
}
.tutorials img{
width:100px;
height:80px;
border:2px solid #000000;
}
dl dt{
font-size: 17px;
font-weight: bold;
}
dl dd{
height: 50px;
font-size: 15px;
}
.gallery .top{
text-align: center;
}
.tutorials .top{
text-align: center;
}
#header
{
overflow: hidden;
background: #3b3b3b;
}
.nav-icons{
width: 15px;
height: 15px;
}
.login{
width: 50px;
position: absolute;
top: 118px;
right: 10px;
padding: 9px 20px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
text-decoration: none;
background-color: #3fb8e8;
}
.login:hover {
background-color: #1baae3;
}
#menu
{
float: right;
width: 1250px;
}
.dl{
padding: 0px 0px 0px 50px;
}
.dl .title{
font-weight: bold;
font-size: 16px;
}
.dl .comp{
text-align: justify;
font-size: 16px;
padding: 0px 170px 0px 0px;
}
#menu ul
{
margin: 0px;
padding: 20px 0px 0px 0px;
list-style: none;
}
#menu li
{
float: left;
margin-left: 10px;
}
#menu a
{
padding: 15px 30px;
letter-spacing: 2px;
text-decoration: none;
text-transform: uppercase;
font-family: 'Archivo Narrow', sans-serif;
font-size: 12px;
font-weight: 600;
color: #FFFFFF;
}
#menu .active a
{
background: #3fb8e8;
border-radius: 5px;
color: #FFFFFF;
}
#menu .active a:hover
{
background-color: #1baae3;
}
#line
{
padding: 12px 0px 1px 0px;
background: #3fb8e8;
}
#contents{
text-align: center;
}
#contents .about{
font-weight: bold;
font-size: 16px;
text-align: left;
padding-left: 380px;
}
#contents .about2{
font-size: 15px;
text-align: left;
padding-left: 380px;
}
#contents .terms{
font-size: 17px;
text-align: justify;
padding-left: 380px;
padding-right: 220px;
}
#content {
width: 600px;
padding: 0 300px;
margin: 0 auto;
}
#content h1 {
text-align: center;
}
.signup{
padding: 0px 0px 0px 440px;
}
#why{
bottom: 70px;
left: 50px;
width: 300px;
height: 300px;
-webkit-border-radius: 5px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: left;
font-weight: bold;
color: #fff;
font-family: Helvetica, sans-serif;
background-color: #3b3b3b;
}
.why a:visited{
color: #3bc;
}
#alter{
bottom: 70px;
right: 50px;
width: 300px;
height: 300px;
z-index: -1;
-webkit-border-radius: 5px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
font-family: Helvetica, sans-serif;
background-color: #3b3b3b;
}
#alter2{
bottom: 200px;
right: 50px;
width: 300px;
height: 200px;
z-index: -1;
-webkit-border-radius: 5px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
font-family: Helvetica, sans-serif;
background-color: #3b3b3b;
}
#alter3{
bottom: 200px;
left: 50px;
width: 300px;
height: 200px;
z-index: -1;
-webkit-border-radius: 5px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
font-family: Helvetica, sans-serif;
background-color: #3b3b3b;
}
#down{
position: relative;
padding: 0px 23px 10px 70px;
}
.Facebookbtn{
bottom: 250px;
right: 100px;
width: 200px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #3b5998;
}
.Facebookbtn:hover{
background-color: #8b9dc3;
}
.Twitterbtn{
bottom: 200px;
right: 100px;
width: 200px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #3cf;
}
.Twitterbtn:hover{
background-color: #0084b4;
}
.Googlebtn{
bottom: 150px;
right: 100px;
width: 200px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #dc4b38;
}
.Googlebtn:hover{
background-color: #c83e2e;
}
.Facebookbtn2{
bottom: 350px;
right: 100px;
width: 200px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #3b5998;
}
.Facebookbtn2:hover{
background-color: #8b9dc3;
}
.Twitterbtn2{
bottom: 290px;
right: 100px;
width: 200px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #3cf;
}
.Twitterbtn2:hover{
background-color: #0084b4;
}
.Googlebtn2{
bottom: 230px;
right: 100px;
width: 200px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #dc4b38;
}
.Googlebtn2:hover{
background-color: #c83e2e;
}
#contact{
padding: 0px 110px 0px 0px;
}
.label {
display: inline-block;
width:120px;
text-align: right;
padding: 10px;
font-weight:bold;
}
.send{
width: 150px;
left: 590px;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #3fb8e8;
}
.now{
width: 150px;
left: 125px;
bottom: 230px;
position: absolute;
padding: 10px 26px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
cursor:pointer;
font-family: Helvetica, sans-serif;
background-color: #3fb8e8;
}
.now:hover {
background-color: #1baae3;
}
.Social {
height: 40px;
width: 40px;
}
.Social:hover {
-webkit-filter: grayscale(100%);
}
.send:hover {
background-color: #1baae3;
}
#footers
{
height: 120px;
padding: 35px 0px 35px 0px;
background: #444444;
}
#footer
{
height: 200px;
color: #B1B1B1;
}
#footer header
{
margin-bottom: 2px;
font-size: 20px;
font-weight: 400;
color: #FFFFFF;
}
#footer #footerbox
{
position: relative;
left: 520px;
width: 300px;
}
#footerbox2 header
{
margin-bottom: 2px;
font-size: 20px;
font-weight: 400;
color: #FFFFFF;
}
#footerbox2
{
color: #B1B1B1;
position: relative;
left: 60px;
bottom: 130px;
width: 300px;
}
#footerbox2 a:visited
{
color:#B1B1B1;
}
#footerbox2 a:active
{
color:#B1B1B1;
}
#footerbox2 a
{
color:#B1B1B1;
}
#footerbox3
{
color: #B1B1B1;
position: relative;
left: 970px;
bottom: 250px;
width: 300px;
}
#footerbox3 header
{
margin-bottom: 2px;
font-size: 20px;
font-weight: 400;
color: #FFFFFF;
}
.go {
width: 20px;
position: absolute;
bottom: 2px;
padding: 6px 20px;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #fff;
border-radius: 3px;
font-family: Helvetica, sans-serif;
text-decoration: none;
background-color: #3fb8e8;
}
.go:hover {
background-color: #1baae3;
}
#copyright
{
text-align: center;
color: #606060;
}
"FAQ" should sit in a block container (like div) and have a style="text-align:center;" on it.
The questions and answers should sit in a separate container with a style="text-align:left;" in it.
You can put the answers in divs with a style="padding-left:20px" or so.
Remove the align=center from your div that contains the FAQs
<div align="center">
I've updated your fiddle: http://jsfiddle.net/jzxe3/
align="center" is deprecated. you should switch it to a class or ID.
I've updated the JSFiddle with the changes and added 2 lines of CSS at the end.
.content {
padding: 0 20px;
}
.content h1 {
text-align: center;
}
The containing div's attributes has been changed from align="center" to class="content".
The additional CSS above adds padding to that div container to the left and right by 20px, and centers the h1 inside the div using text-align: center.
Let's assume that you wrap your page title within <h1> tags, your questions in <h2> tags and your answers in <p> tags, as in the following HTML snippet:
<h1>FAQ</h1>
<h2>Question</h2>
<p>Answer to the question.</p>
These are all block level elements, for which you can achieve your desired formatting by using something like the following CSS:
h1 { text-align: center; }
h2 { text-align: left; }
p { margin-left: 2ex; }
You can, of course, use <div>s with a class instead of the heading and paragraph elements.
Please help!
I tried many tricks to remove the white space under my footer but none of them solved my problem. I noticed that the white space is only visible in the pages with text, p and h1 tags. Any help is highly appreciated.
HTML:
<!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>Olive Green Studio</title>
<link href="oliva.css" rel="stylesheet" type="text/css" />
<!—[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]—>
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>
<body class="twoColFixLtHdr">
<div id="container">
<div id="header"><!-- end #header -->
<div id="logo">
<a href="index.html">
<img src="olivaimages/olivegreenlogoweb.png" border="none"/>
</a>
</div>
<div id="sidebar1">
<ul>
<li>Home</li>
<li>Work</li>
<li>About</li>
<li>Contact</li>
</ul>
<!-- end #sidebar1 --></div>
</div>
<div id="mainContent">
<h1>Contact Us </h1>
<p>If you need a creative help or want to take your project to the next level please don't hesitate to drop us a line.</p>
<a class="worklinks" href= "mailto:info#olivegreenstudio.com"> info#olivegreenstudio.com</a>
<!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<div class="clearfooter"></div>
<!-- end #container -->
</div>
<div id="footerframe">
<div id="footer">
<div id="footer2">
<div id="address">Khobar<br> Saudi Arabia </div>
<div id="contact">
<strong>Services:</strong><br> Logos<br>Branding<br>Identity<br>Collaterals<br>Packaging<br> Web Design & Development <br>
</div>
<div id="email">
If you have a project inquiry, we will be happy to answer you <a class="contactlink" href="mailto:info#olivegreenstudio.com"> here.</a>
</div>
<div class="social">
<div class="twitter">
<a href="https://twitter.com/OliveGreenSTU" />
<img src="olivaimages/twitterbirdwebgreen.png" onmouseover="this.src='olivaimages/twitterbirdweb-lightgreen.png'" onmouseout="this.src='olivaimages/twitterbirdwebgreen.png'" />
</div>
</a>
<div id="pinterest">
<a href="http://pinterest.com/olivegreenstu/">
<img src="olivaimages/pinterestwebgreen.png" onmouseover="this.src='olivaimages/pinterestweb-lightgreen.png'"
onmouseout="this.src='olivaimages/pinterestwebgreen.png'" />
</a>
</div>
<div class="copywrite"> © 2013 Olive Green. All rights reserved.</div>
</div>
</div>
</div>
</div>
</body>
</html>
CSS:
#charset "UTF-8";
body {
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 100%;
background-color: #FFFFFF;
height: 100%;
}
.twoColFixLtHdr #header {
height: 170px;
background-color: #FFFFFF;
background-repeat: no-repeat;
background-position: center center;
margin: 0px;
padding: 0;
}
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
color: #5A6219;
text-decoration: none;
font-style: normal;
font-weight: normal;
padding-bottom: 20px;
}
h2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: normal;
color: #908B23;
text-decoration: none;
line-height: 1.5em;
margin-bottom: 30px;
}
p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: 1.5em;
font-weight: normal;
color: #908B23;
text-decoration: none;
margin: 0px;
}
.twoColFixLtHdr #container {
width: 900px;
text-align: left; /* this overrides the text-align: center on the body element. */
min-height: 100%;
margin-top: 0;
margin-right: auto;
margin-left: auto;
position: relative;
margin-bottom: -215px;
height: 100%;
}
.twoColFixLtHdr #mainContent {
height: 100%;
background-color: #FFF;
float: left;
width: 100%;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCC;
padding-top: 50px;
padding-bottom: 70px;
}
.workmaincontent {
height: 100%;
background-color: #FFF;
float: left;
width: 100%;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCC;
padding-top: 50px;
padding-bottom: 70px;
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
.twoColFixLtHdr #sidebar1 {
float: right; /* since this element is floated, a width must be given */
width: 300px;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 15px;
padding-left: 20px;
margin-top: 70px;
background-color: #FFFFFF;
height: 30px;
}
#sidebar1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
height: 200px;
line-height: 1.5em;
text-decoration: none;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
width: 500px;
}
#sidebar1 ul {
background-color: #FFFFFF;
list-style-type: none;
margin: 0px;
padding: 0px;
}
#sidebar1 li {
display: run-in;
list-style-type: none;
}
#sidebar1 a {
display: run-in;
text-decoration: none;
color: #918C10;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
font-weight: normal;
padding: 5px;
float: left;
width: 65px;
}
#sidebar1 a:hover {
color: #5A6219;
}
.worklinks{
font-family: Arial, Helvetica, sans-serif;
color: #5A6219;
text-decoration: none;
}
.worklinks:hover{
font-family: Arial, Helvetica, sans-serif;
color: #908B23;
text-decoration: none;
}
#print{
height: 100%;
background-color: #FFF;
width: 730px;
float: left;
padding-right: 15px;
padding-left: 15px;
margin-left: 85px;
margin-right: 85px;
}
#web{
height: 100%;
background-color: #FFF;
width: 730px;
float: left;
padding-right: 15px;
padding-left: 15px;
margin-left: 85px;
margin-top: 50px;
margin-bottom: 50px;
}
#packaging{
background-color: #FFF;
height: 100%;
width: 730px;
float: left;
padding-right: 15px;
padding-left: 15px;
margin-left: 85px;
}
.imagetitles a {
text-decoration: none;
font-family: "Century Gothic";
font-size: 25px;
font-style: normal;
font-weight: normal;
color: #00CCCC;
}
#printtitle{
bottom: -5px;
left: 333px;
}
#webtitle{
position: absolute;
left: 333px;
top: 521px;
}
#packagingtitle{
position: absolute;
left: 317px;
top: 823px;
width: 89px;
}
#bigimages{
width: 570px;
height: 100%;
}
.imagestalk {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-style: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
font-size: 14px;
line-height: 1.5em;
padding-top: 5px;
padding-right: 15px;
padding-bottom: 10px;
padding-left: 20px;
}
.thumbnails {
border: 5px solid #666666;
}
h3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: 1.5em;
font-weight: normal;
color: #5A6219;
text-decoration: none;
}
h3 a:link {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000000;
font-style: normal;
font-weight: normal;
text-decoration: none;
}
h3 a:visited {
color: #D0BA0B;
text-decoration: underline;
}
h3 a:hover {
color: #5A6219;
}
h3 a:active {
color: #579835;
}
.back{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
padding-left: 520px;
}
.back a:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
font-size: 14px;
font-style: normal;
font-weight: normal;
color: #666666;
}
.back a:visited {
color: #666666;
text-decoration: none;
}
.back a:hover {
color: #000000;
text-decoration: none;
}
.back a:active {
color: #333333;
text-decoration: none;
}
.source{
font-size: 15px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-style: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
.workimage {
height: 150px;
width: 200px;
float: left;
margin: 20px;
}
img {
border: 0;
}
#logo {
height: 150px;
width: 300px;
float: left;
}
#footerframe {
width: 100%;
background-color: #AEA03A;
height: 215px;
position: relative;
float: right;
}
#footer {
width: 900px;
font-family: Verdana, Arial, Helvetica;
font-size: 11px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-decoration: none;
margin-right: auto;
margin-left: auto;
background-color: #AEA03A;
float: none;
position: relative;
height: 215px;
}
#footer2 {
width: 100%;
background-color: #AEA03A;
padding-top: 30px;
float: left;
position: relative;
}
#address {
height: 50px;
width: 180px;
background-color: #AEA03A;
float: left;
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-decoration: none;
color: #5A6219;
line-height: 1.5em;
}
#contact {
height: 130px;
width: 180px;
background-color: #AEA03A;
float: left;
text-align: left;
margin-right: 180px;
margin-left: 180px;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #5A6219;
text-decoration: none;
line-height: 18px;
}
#email {
background-color: #AEA03A;
height: 50px;
width: 180px;
float: right;
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #5A6219;
text-decoration: none;
}
.social {
background-color: #AEA03A;
height: 35px;
width: 100%;
float: right;
margin-top: 20px;
}
#pinterest {
height: 20px;
width: 20px;
float: left;
background-repeat: no-repeat;
margin-left: 15px;
margin-bottom: 15px;
}
.twitter {
height: 20px;
width: 20px;
background-repeat: no-repeat;
float: left;
margin-bottom: 15px;
}
.copywrite {
font-size: 11px;
font-weight: lighter;
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
text-align: right;
width: 300px;
background-color: #AEA03A;
float: right;
height: 15px;
color: #5A6219;
vertical-align: middle;
margin-bottom: 10px;
margin-top: 5px;
}
.contactlink {
font-family: Arial, Helvetica, sans-serif;
color: #5A6219;
text-decoration: none;
}
.contactlink a {
font-family: Arial, Helvetica, sans-serif;
color: #5A6219;
text-decoration: none;
}
.contactlink:hover {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
text-decoration: none;
}
h4 {
color: #5A6219;
}
.indeximg {
height: 100px;
width: 900px;
background-repeat: no-repeat;
background-position: center top;
background-image: url(../olivaimages/indeximg.png)
}
.indexwrap {
height: 100%;
width: 810px;
padding-left: 90px;
}
#wrapper {
min-height: 100%;
}
.clearfooter {
height: 215px;
clear: both;
}
try this
#footerframe {
background-color: #AEA03A;
bottom: 0;
float: right;
height: 223px;
position: absolute;
width: 100%;
}
Replacing the footers 900px with 100% should do the trick.
I think you'll need implement a sticky footer technics by setting html,body height to 100% and
setting id#container as the following:
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#container {
height: auto !important;
min-height: 100%;
height: 100%;
}
example