In my test page, at the bottom, there is a large white gap between the footer and the body, I can't figure out why.
Test page
HTML:
<div id="content">
<article>
<div class="social">
<!--Widget code-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!--End Widget code-->
<!--FACEBOOK BUTTON
<div class="fb-like" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div> -->
<!--End FACEBOOK BUTTON-->
<div class="sslbreadcrumbs">
<!--first level-->
You are here: Cancer Fighters homepage / Sweat
<!--second level-->
<!--third level-->
</div>
</div>
<div id="content-area">
<!-- Content Placeholder -->
</div>
<div>
[[S63:3]]
<!--Button will only load on Homepage, this is NOT using Luminate Conditional code, see hmpgonly.js -->
<div class="button-container" id="hmpgonly"> Start a Fundraiser
</div>
</div>
<!-- //Content Placeholder -->
</div>
</div>
</article>
</div>
<!--================================================================
FOOTER
==============================================================-->
<footer>
<div id="footer-bottom">
<div class="footer-cell-container">
<div id="footer-cell-one" class="footer-cell">
<h2>Be a Cancer Fighter</h2>
<ul>
[[S51:GEN_ON_Reus_CancerFighter_IFE_Footer]]
<br>
</ul>
</div>
<div id="footer-cell-two" class="footer-cell">
<h2>About the Program</h2>
<ul>
<li>About the Program</li>
<li>About the Society</li>
<li>Where your money goes</li>
<li>FAQs</li
</ul>
</div>
<div id="footer-cell-three" class="footer-cell">
<h2>Get Started</h2>
<ul>
<li>Create a fundraiser</li>
<li>Join a fundraiser</li>
<li>Participate as an<br />individal</li>
<li>Pledge a participant<br />or fundraiser</li>
<li>Donate now</li>
</ul>
</div>
<div id="footer-cell-four" class="footer-cell">
<h2>Canadian Cancer Society</h2>
<ul>
<li><a title="What we do" href="http://www.cancer.ca/en/?region=on"target="_blank">What we do</a></li>
<li><a title="Privacy policy" href="http://www.cancer.ca/en/about-our-site/privacy-policy/?region=on"target="_blank">Privacy policy</a></li>
<br />
<br />
</ul>
</div>
<div id="footer-cell-five" class="footer-cell">
<br>
<ul>
<li>Copyright [[S9:pattern:yyyy]] Canadian Cancer Society </li>
<li>Charitable Registration no. 118829803 RR00001</li>
<br />
</ul>
</div>
</div>
</div>
</footer>
the CMS conditional S tag you'll see there [[S63:3]] it inserts the body of text and such that you see on the test page.
The css for div id=content:
#content {
width: 100%;
max-width: 970px;
margin: 0 auto 122px auto;
overflow: auto;
overflow-y: hidden;
}
When I inspect the page it shows me that content is 970 x 1802, I don't understand where 1802 is being pulled from?
Any suggestion is greatly appreciated! thank you for your time.
Open your dev tools and look at .button-container
Remove the min-height and margin-top rules and you will see that space disappear.
Granted, now your button is not positioned properly. You may want to rethink the layout of your article body, and as Mr Lister mentioned, not set the position of the final element as relative since it is still taking up space even though it is visually in a separate place.
at first your div #content has a margin-bottom setted.
try with this code:
#content {
margin-bottom: 0
}
at second I think you have some javascript that resize some div.
try to disable some script in your test page (or provide a working plunker)
Change the margin on #content to -100px;
#content {
width: 100%;
max-width: 970px;
margin: 0 auto -100px auto;
overflow: auto;
overflow-y: hidden;
}
Related
I'm brand new to web development and I have build a little website with 3 pages. My goal is to use #media tags to make it responsive for the following: max-widths: 980px, 768px and 640px. I did the first page and it's been acting weird. How can I make the entire website responsive? Please to assist. My code for all 3 pages and the media is attached. Thanks.
/*first page */
<head>
<title>AboutMe</title>
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container">
<div class="top">
<div class="myname">
<h4 class="firstlast">name</h4>
</div>
<div class="list">
<ul>
<li class="contact">Contact</li>
<li class="portfolio">Portfolio</li>
<li class="about">About</li>
</ul>
</div>
</div>
<div class="middle-about-me">
<div class="center">
<h3> About Me</h3>
<hr>
<p class="myinfo">Hi my name is ..... and I was born on October 9th, 1971 in ......
<img src="assets/img/author.jpg" width="150px" height="150px"><br>
To briefly introduce the... to you I would say it is a country located on the........>
shares the same borders with ....... It is the world largest<br>
producer of coacoa used for chocalate and lotions. In one word, it's the country where chocolate tastes like<br> real chocolate. Since the last discovery of petrol in the country, it's been a little agitated as France and the<br>US want to control the discovery. After obtaining my masters in Business Management, I worked as the marketing representative for an american company before moving to the US to pursue a degree in Mathematic at UNT Dallas and worked for...,...., and.... as a Math instructor. My goal in this program is to learn to build websites from scratch and later on to build apps from scratch. I've got the right instructional staff and the right TAs to help me reach that goal. All I have to do is to go to work.<br> "Impossible is nothing", Muhammad Ali.</p>
<p class="smile"><i>hover on my picture and start smiling</i></p>
</div>
</div>
<div class="footer">
<p class="footer-copyright">Copyrigtht © 2019 Portfolio "name" All rights reserved.</p>
</div>
</div>
</body>
/*second page */
<body>
<div class="container">
<div class="top">
<div class="myname">
<h4 class="firstlast">name</h4>
</div>
<div class="list">
<ul>
<li>Contact</li>
<li>Portfolio</li>
<li>About Me</li>
</ul>
</div>
</div>
<div class="middle">
<div class="center-portfolio">
<h3> Portfolio</h3>
<hr>
<div class="div1"><img src="assets/img/career1.jpg" height="120px" width="150px"></div>
<div class="div2"><img src="assets/img/chocolatour.jpg" height="120px" width="150px"></div>
<div class="div3"><img src="assets/img/guildhouse.jpg" height="120px" width="150px"></div>
<div class="div4"><img src="assets/img/career2.jpg" height="120px" width="150px"></div>
<div class="rotateIn div5"><img src="assets/img/Abidjan1.jpg" height="120px" width="150px"></div>
<div class="div6"><p><i>please to hover on the images</i></p></div>
<div class="banner1">career picture 1</div>
<div class="banner2">chocolate tour</div>
<div class="zoomIn banner5">Abidjan</div>
<div class="banner4">career picture 2</div>
<div class="banner3">Guild Brussels</div>
</div>
</div>
<div class="footer">
<p class="footer-copyright"> Copyrigtht © 2019 Portfolio "name" All rights reserved.</p>
</div>
</div>
</body>
/*third page */
<body>
<div class="container">
<div class="top">
<div class="myname">
<h4 class="firstlast">name</h4>
</div>
<div class="list">
<ul>
<li>Contact</li>
<li>Portfolio</li>
<li>About Me</li>
</ul>
</div>
</div>
<div class="middle">
<div class="center">
<h3> Contact</h3>
<hr>
<form>
Name:<br>
<input id="namebox" type="text" name="name" required="" placeholder="your name">
<br><br>
Email:<br>
<input id="emailbox" type="Email" name="email" required="" placeholder="example#yahoo.com">
<br><br>
Message:<br>
<textarea id="messagebox" style="height: 200px; " name="message" placeholder="Enter massage here" required="">
</textarea>
<br><br>
<input type="submit" value="submit" name="submit">
</form>
<br>
</div>
</div>
<div class="footer">
<p class="footer-copyright">
Copyrigtht © 2019 Portfolio "name" All rights reserved.
</p>
</div>
</div>
</body>
/* Width at 768px and below */
#media screen and (max-width: 768px) {
body {
background-color : #E9967A;
}
.container {
background-color: green;
border-style: none;
width: 50%;
}
.middle-about-me,
.footer, .top{
width: 50%;
}
.middle-about-me{
width: 50%%;
}
}
/*Width at 640px and below */
#media screen and (max-width: 640px) {
body {
background-color : #E9967A;
}
.container {
background-color: green;
border-style: none;
width: 50%;
}
.middle-about-me,
.footer, .top{
width: 50%;
}
.middle-about-me{
width: 50%%;
}
}
Start out by removing fixed width properties. I am having a hard time seeing how you need width: 50% on everything. Then start by just addressing the styles of your .container element.
A good techniques is setting the max-width to the width you have in mind for the site to be viewed on a normal desktop screen, in the demo I used 600px but you can use any value that feels right.
Then in you media query assign a new max-width value that is appropriate for the screen size in the query, here i used 80% becuase typically on small screens you want the content to mostly fill the width of the screen with a little space on the sides, but again you can configure this to your needs in a variety of ways.
The main thing here is that your container element is now responsive and the content inside can fill up the space however you like from there. Run the snippet and click the Full page link to play around with the screen width and see the behavior working.
.container {
max-width: 600px;
margin: 0 auto;
}
#media screen and (max-width: 640px;) {
.container {
max-width: 80%;
}
}
<div class="container">
<div class="top">
<div class="myname">
<h4 class="firstlast">name</h4>
</div>
<div class="list">
<ul>
<li class="contact">Contact</li>
<li class="portfolio">Portfolio</li>
<li class="about">About</li>
</ul>
</div>
</div>
<div class="middle-about-me">
<div class="center">
<h3> About Me</h3>
<hr>
<p class="myinfo">Hi my name is ..... and I was born on October 9th, 1971 in ......
<img src="assets/img/author.jpg" width="150px" height="150px"><br>
To briefly introduce the... to you I would say it is a country located on the........>
shares the same borders with ....... It is the world largest<br>
producer of coacoa used for chocalate and lotions. In one word, it's the country where chocolate tastes like<br> real chocolate. Since the last discovery of petrol in the country, it's been a little agitated as France and the<br>US want to control the discovery. After obtaining my masters in Business Management, I worked as the marketing representative for an american company before moving to the US to pursue a degree in Mathematic at UNT Dallas and worked for...,...., and.... as a Math instructor. My goal in this program is to learn to build websites from scratch and later on to build apps from scratch. I've got the right instructional staff and the right TAs to help me reach that goal. All I have to do is to go to work.<br> "Impossible is nothing", Muhammad Ali.</p>
<p class="smile"><i>hover on my picture and start smiling</i></p>
</div>
</div>
<div class="footer">
<p class="footer-copyright">Copyrigtht © 2019 Portfolio "name" All rights reserved.</p>
</div>
</div>
I wish you had a sketch of what the final product will look like it would have been very helpful. There is more to making a page responsive than writing just valid HTML tag and corresponding styles and mind typos because from your code the extra % sign will make
.middle-about-me{
width: 50%%;
}
misbehave.
There a couple of things you need to know to be able to make a page responsiveness effective and very close to what you want.
Firstly you should consider resetting the default styles that the browser naturally applies to valid HTML tags by using normalize.css or utilize the power of universal selector which is almost as good in modern browsers, something like:
*,
*::before,
*::after{
padding: 0;
margin: 0;
box-sizing: inherit; /* to inherit the value declared in the body selector */
}
html{
font-size: 62.5% /* (10/16) * 100% and this is possible because by default the value of 100% will be computed to 16px by the browser and equal to 1(r)em, with this conversion we can reduce the calculations whenever you want to convert a value from px to (r)em since the are in multiples of 10 eg 1(r)em == 10px and 10(r)em == 100px*/
}
body{
box-sizing: border-box;
}
img{
width: 100%;
min-width: 27rem; /* to make the images responsive and look good on smaller screens */
}
so with the that basic reset you can always rely on using ems or rems for fonts an percentages for images and other block element when it feels appropriate.
This little write up is not enough to teach you all you need to know about responsiveness in the web but I hope it shed light on your path. Meanwhile those were not my original ideas i took a course by 'Jonas Schmedtman', He actually thought me those.
If you have a sketch of what the final pages should look like or you are still not very clear with what i have tried to explain so far please don't hesitate to add a comment so that we tidy it up together.
I have a footer at the bottom of my pages, a box ad at the top of that footer, and a form. These 3 elements are spaced out appealingly (only on my screen size) through position: absolute. Whenever I change my browser size, I've made it so that the footer stays away from my ad and doesn't overlap. My form never overlaps with my ad when resized and it is perfect for all screen sizes. On the other hand, my footer overlaps my ad on different screen sizes, and I don't want to spend time on all my pages adding media queries to fix this. If the screen size is small, the footer will either overlap or be way down at the bottom. Also, whenever a user opens a page with a screen width of greater than 500, the ad becomes a horizontal ad,leaving empty space and making the website unappealing at the bottom. This is an example of my css code:
#footer{
position: absolute;
left: 0px;
right: -2px;
bottom: -300px;
margin-bottom: -400px;
background-color: black;
width: 100%;
height: 200px;
}
Media query:
#media screen and (max-width: 1050px)
{
#footer{
margin-bottom: -500px;
}
}
I also have another footer (mobFooter) that comes out and hides the original footer. This footer is for mobile devices. I am doing the same thing with it, with media queries and it's not working out. How do I make it so that the footers are always at the bottom and have a certain amount of space between them and the ad? Also, if the ad becomes a horizontal ad (box to horizontal), how do I make the footer take up that unused space?
HTML code:
<div id="ad2">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- YC ads -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4549632347845332"
data-ad-slot="4159114047"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div id="footer">
<div id="mobFooter">
<p>Home</p>
<hr>
<p>Normal Submit</p>
<hr>
<p>Premium Submit</p>
<hr>
<p>Advertising | Contact us</p>
<hr>
<p>Terms | Privacy</p>
</div>
<div id="social">
<ul>
<li><img src="/submit/assets/facebook.png"/></li>
<li><img src="/submit/assets/twitter.png"/></li>
<li><img src="/submit/assets/youtube.png"/></li>
</ul>
</div>
<img src="/submit/assets/logo.png"/>
<ul>
<li>Home</li>
<li>Normal Questions</li>
<li>Premium Questions</li>
<li>Advertising</li>
</ul>
<div id="policies">
<ul>
<li>Terms of Use</li>
<li>Privacy</li>
<br>
<li id="net">Contact us</li>
</ul>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="/submit/validation.js"></script>
I've included the HTML code where my ad is and where my footer, and mobFooter is. Note: mobFooter is hidden until screen size reaches 500px.
<div id="ad2">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- YC ads -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4549632347845332"
data-ad-slot="4159114047"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div id="footer">
<div id="mobFooter">
<p>Home</p>
<hr>
<p>Normal Submit</p>
<hr>
<p>Premium Submit</p>
<hr>
<p>Advertising | Contact us</p>
<hr>
<p>Terms | Privacy</p>
</div>
<div id="social">
<ul>
<li><img src="/submit/assets/facebook.png"/></li>
<li><img src="/submit/assets/twitter.png"/></li>
<li><img src="/submit/assets/youtube.png"/></li>
</ul>
</div>
<img src="/submit/assets/logo.png"/>
<ul>
<li>Home</li>
<li>Normal Questions</li>
<li>Premium Questions</li>
<li>Advertising</li>
</ul>
<div id="policies">
<ul>
<li>Terms of Use</li>
<li>Privacy</li>
<br>
<li id="net">Contact us</li>
</ul>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="/submit/validation.js"></script>
$(document).ready(function(){
var footerHeight=$("#footer").height();
$("body").css("padding-bottom",footerHeight);
});
$(window).resize(function(){
var footerHeight=$("#footer").height();
$("body").css("padding-bottom",footerHeight);
});
body{position: relative;}
#footer{
position: absolute;
left: 0px;
right: -2px;
bottom: 0;
background-color: black;
width: 100%;
}
Refer Fiddle
Just used the jquery to identify the height of the footer and used padding-bottom for the body
Here is my code:
<div class="wrap">
<div id ="header">
<a href="index" class = "logo">
<img src = "logo.png" alt = "" />
</a>
<nav class="navigation">
<ul>
<li>Share</li> |
<li>Join</li> |
<li>See Safty Tips</li> |
<li>Settings</li>
</ul>
</nav>
</div>
<div class="wrapper">
<img src="accident.png" alt="">
<div id="right-content">
<h2>Hit and Run No Injuries</h2>
<p>2.610 miles from your new neighbor<br />
May 20, 2015 at 12.34 PM </p>
<h4>California HWP 2 - High Level</h4>
</div>
</div>
<div class="wrap">
<ul class="secure_v5">
<li id="li-incident">
<a class="inviteLink dark" href="/v5/Resources.aspx?IFrameURL=Invitationv5&vn=&gORn=1">See Incident Location</a>
</li>
<li id="login-signup">
<a class="button dark" href="V4/Login.aspx?v5=1">Share Incident with Friends</a>
</li>
</ul>
</div>
<div class="thanks">
<p>Sincerely,<br />
The AlertID Team</p>
</div>
<p style="text-align:center;">This sponsor is helping to protect your neighborhood</p>
<div class="footer-links">
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
and here is jsfiddle , (didn't include images)
When i run this code, some alignment is not correct,
I need something same like this
I just confused with which exact css can be used, Can anyone help me please?
Thanks,
Use HTML tables to control the design layout and some presentation. You may be used to using pure CSS layouts for your web pages, but that approach just won’t hold up in an email environment.
Use inline CSS to control other presentation elements within your email, such as background colors and fonts.
You just put div #right-content to right
try it on CSS.
#right-content {
float:right;
width:600px;
}
#right-content h2{
text-align:center;
}
I create a little attribute to h2 inside div #right-content
and define a fixed width for right-content. It's necessary because of attribute float: right.
I'm using 2 languages on my website: Arabic / English
English version: everything is OK.
I'm facing problem with Arabic version only when opening website on Chrome only, if you can check it here online (Arabic):
Here
You will see top margin above header, I'm trying to remove it but I have no idea where it's coming from but it's removed from English version successfully
It will start above .header-wrapper class.
HTML Code :
<div class="header-wrapper">
<div id="welcome">
<form action="http://staging.wain.com.kw/index.php?route=module/language" method="post" id="language_form" enctype="multipart/form-data">
<div id="language">
<a title="English" onclick="$('input[name=\'language_code\']').attr('value', 'en'); $('#language_form').submit();">
English
</a>
<input type="hidden" name="language_code" value="">
<input type="hidden" name="redirect" value="http://staging.wain.com.kw/index.php?route=common/home">
</div>
</form>
<span>مرحبا بالزائر يمكنك</span>تسجيل الدخول<b>أو</b>تسجيل جديد
<div class="links">
حسابي <ul>
<li>حسابي</li>
<li>سلة الشراء</li>
<li>إكمال الطلب</li>
</ul>
</div>
قائمة المقارنة
قائمة رغباتي (0)
</div>
<div id="header" class="sunset">
<div id="menu">
<span>Menu</span>
<ul>
<li class="home"><a title="الرئيسية" href="http://staging.wain.com.kw/index.php?route=common/home"><span><i class="icon-home"></i></span></a></li>
<li>أكواب
</li>
<li>الإكسسوارات
</li>
<li>بوستر
</li>
<li>سماعات
</li>
<li>ملابس
<div>
<ul>
<li>تي شيرت (19)</li>
<li>طويلة الأكمام (2)</li>
<li>قبعات (2)</li>
<li>هودي (3)</li>
</ul>
</div>
</li>
<li>ملصقات
</li>
</ul>
</div>
<div id="logo"><img src="http://staging.wain.com.kw/image/data/logo2.png" title="WAIN" alt="WAIN"></div>
<div id="cart">
<div class="heading">
<h4><i class="icon-shopping-cart"></i><!--سلة الشراء--></h4>
<a><span id="cart-total">سلة الشراء فارغة!</span></a></div>
<div class="content">
<div class="empty">سلة الشراء فارغة!</div>
</div>
</div> </div>
</div>
CSS Code:
.header-wrapper {
max-width: 1200px;
margin: 0px auto 0px;
}
Thank you.
Right after you <body> tag there is a lot of white-space. remove it and the space is gone.
It's generally recommended to keep the markup as clean as possible to avoid porblems like this in the future.
<body>
<meta charset="UTF-8">
After the body tag, there is a whitespace. You need to remove that white space to avoid the margin top.
I'm new and i have a question about CSS3 and :empty pseudo-class.
I create a web ajax application. In my page layout I've got a sidebar and i want to hide this if is empty. So i wrote:
#my_sidebar:empty { display:none;}
For display it when isn't empty i wrote
#my_sidebar:not(:empty) { display:block; }
This is working but with chrome the sidebar appear only after one click on the page or on a link. Why?
Can someone help me?
Thanks! (excuse me for my terryfing english!!)
EDIT:
the html page:
<body id='body'>
<!-- Header -->
<header id="top" class="cf">
<div id="branding">
<h1>Project Management</h1>
</div>
<nav id="nav-user">
<ul>
<li><a id="user" href="profilo"><span id="username"></span><img id="avatar" class="avatar"></a></li>
<li><a id="company" href="azienda">Azienda</a></li>
<li><a id="logout" href="logout">Logout</a></li>
</ul>
</nav>
<nav id="nav-main">
<ul class="cf">
<li>
<button id="back" onClick="javascript: history.back();" href="#" />←</button></li>
</ul>
<!--popup con task finiti -->
<div id="task-ended" class="cf">
<div class="triangle-border top">
<div class="clear"></div>
</div>
</div><!--task-ended-->
<!--popup con task finiti -->
</nav>
</header>
<!-- Main Body -->
<div id="container" class="cf">
<div id="loading" style="display:none"><img src="images/loading.gif" /></div>
<div id="my_sidebar" class="sidebar"></div>
<div id="main" class="main"></div>
</div>
<footer class="cf" id="footer">
Mentis Project Management
</footer>
</body>
and css:
.sidebar {
float:right;
width: 36%;
text-align:left;
}
The Chrome bug apparently only happens with the display property, so you can instead set visibility: hidden; to make it invisible and position: absolute; to prevent the space from being reserved. This doesn't require the use of :not(:empty).
As always, whenever you find yourself pushing browsers to their limits, stop and ask yourself if there's a simpler way to do the job. Depending on what you need, simple calls to jQuery's show() and hide() method could work just as well. :)