text over flowing edge even when it is responsive - html

I have made my text responsive and it is working in most pages but on my homepage it overflows the edge when the window is resized.
h12 {
width: 120%;
display: block;
padding-top: 40px;
padding-bottom: 30px;
padding-left: 15%;
padding-right: 5%;
font-weight: 700;
color: #ffffff;
text-align: center;
font-size: 20px;
color: #a7ad8d;
-webkit-font-smoothing: antialiased;
-webkit-overflow-scrolling: touch;
position: relative;
overflow: auto;
}
h9 {
display:block;
text-align: left;
font-family: a;
color: #ffffff;
font-size: 14px;
margin-top: 20px;
-webkit-font-smoothing: antialiased;
-webkit-overflow-scrolling: touch;
}
#headerwrap {
background: url(../img/back.jpg) no-repeat center top;
margin-top: -70px;
padding-top: 250px;
text-align: left;
background-attachment: relative;
background-position: center center;
min-height: 650px;
min-width: 200px;
width: 100%;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#headerwrap h9 {
padding-left: 5%;
padding-right: 84%;
width: 1200px;
text-align: left;
padding-top: 5px;
font-weight: 400;
color: #ffffff;
-webkit-font-smoothing: antialiased;
-webkit-overflow-scrolling: touch;
float: none;
margin-left: auto;
margin-right: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div id="headerwrap">
<div class="container">
<div class="row">
<div class="col-lg-6 col-lg-offset-2">
<h12>WE ALIGN PROFESSIONAL FIRMS TO ACHIEVE THEIR GREATEST VALUE</h12>
<h9> Worthmore provides the focus, structure, accountability and support so leaders can take their firm to continuous improvement and growth.</h9>
<h9> Our leadership and experience in Accounting & Financial Services, and in significant senior corporate roles, provides a breadth of knowledge that can be applied to a multitude of business environments and situations.
We add value by asking the questions that need to be asked, and providing insights and input into the decision-making process.</h9>
</div>
</div>
</div>
</div>

for body set overflow:hidden; css: body{ overflow:hidden}

Remove width from following:
headerwrap h9
And from h12
By adding those unwanted width (120% and 1200px) you are going out of content area and hence getting horizontal scroll.
Is this RWD website you creating? then please read this:
https://www.smashingmagazine.com/2011/01/guidelines-for-responsive-web-design/
to fully understand RWD (Responsive Web Design)

In responsive design, do not using fixed Width value.
i found you using
#headerwrap h9 {width: 1200px;} this will make your website not responsive
try usng % Value #headerwrap h9 {width: 100%;}

Related

How do I adapt the <main> height to the page when I zoom in and out?

I am learning HTML and CSS and I am trying to replicate the homepage of flickr.com.
I can't get the central part of my page ("Find your inspiration") to stay centered when I zoom in and out. I can't get the <body> content to responsively fill the space between the <header> and the <footer>.
I have spent many hours googling, playing with heights, flex, and trying to reshape the layout of my page, but I can't figure out how to reproduce the desired effect. I think I am messing up the layout (especially with the nesting of my containers) but I can't spot my mistake.
Here are the screenshots of the real flickr.com home page and the screenshot of the clone page I'm trying to build. As you can see, my page doesn't keep the element centered when I zoom out because my block doesn't stretch to fill the space between <header> and <footer>:
My clone home page
Original Flickr home page
html {
background: url(images/8225606733_086c8f3d83_o.jpg)no- repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100%;
}
header {
min-height: 70px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0px 20px;
}
main {
min-height: 400px;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.wrapper {
display: block;
text-align: center;
background-color: lightblue;
font-family: Arial, Helvetica, sans-serif;
padding: 0 30px;
}
.wrapper h1 {
font-size: 40px;
font-weight: bold;
margin-bottom: 18px;
}
.wrapper h2 {
font-size: 25px;
font-weight: normal;
margin-bottom: 50px;
}
.wrapper a {
color: black;
font-weight: bold;
background-color: white;
padding: 12px 23px;
border-radius: 3px;
}
footer {
position: fixed;
width: 100%;
bottom: 0px;
}
<header>
HEADER
</header>
<main>
<div class="wrapper">
<h1>Find your inspiration.</h1>
<h2>Join the Flickr community, home to tens of billions of photos and 2 million groups.
</h2>
<div class="start-button">
Start for free
</div>
</div>
</main>
<footer>
FOOTER
</footer>
try this way:
main {
height: calc(100vh - 70px);
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
You can't center the .wrapper element because you assigned a min-height: 400px to its parent element so it doesn't span for the entire viewport height. Try adding a colored background to the main element and you'll see.

Background image covered up when scroll to the bottom

The background image is covered by white area when you scroll all the way to the bottom. Cannot seem to figure out what it is. Played with each of the selectors and HTML. Would appreciate help. Please click link go to the CodePen where the code is visible.
https://codepen.io/siamazing/pen/QaGdWq
html, body{
height: 100%;
}
#body {
background-image: url(https://images.pexels.com/photos/267278/pexels-photo-267278.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb) ;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #999;
height: 100%;
font-size: 15px;}
.container-fluid {
padding-top: 20px;
padding-left: 40px;
padding-right: 40px;
height: 100%;}
h2 {
padding-left: 20px;
font-family: 'pacifico';
font-size: 22px;
color: #72777f;
}
header {
text-align: center;
font-family: 'pacifico';
}
article {
font-family: 'raleway';
background-color:rgba(255,255,255,.4);
color: #303338;
padding: 10px;
margin-top: 20px;
margin-left: 30px;}
Remove height:100% from #body
https://codepen.io/mirohristov/pen/MrbmWj
See Miro's answer, but here's some troubleshooting advice.
I added * { outline: 1px dashed red; } and saw this:
That made it easier to find the culprit element - #body and remove the height:100%; rule.

Can't click links due to overlapping divs

I have some overlapping divs in my design and my links are not clickable. I know the reason the links aren't clickable is because of said overlapping divs, so I assigned some z-indexes to try and combat that. However, I notice I can only make the links clickable by making the parent div (the one containing the div that actually houses my text) the highest z-index element... Which totally breaks my design and the way it looks. Is there a different way around this that I am not noticing? Or is this a case of having to redo the design completely?
The link to the journal skin I am working on.
I also want to throw a little edit in there mentioning that the side branches housed in the branchoverlay div are intended to overlap the other divs a little bit, see here. I have heard suggestions of removing them from their own div and putting them in the background of contentholder, but that would ruin that effect I think? Is there a better way to format that header/dropdown area to accomplish that slight overlay of the divs without having to do so much overlapping via negative margins?
HTML:
<div class="text"><div class="body">
<div class="menu"><div class="dropdowncontainer"><div class="dropdown">
<span><img src="https://s18.postimg.org/i8xcnc8gp/home.png"></span>
<div class="dropdown-content">
Bacon
Ribs
Steak
</div>
</div><div class="dropdown">
<span><img src="https://s9.postimg.org/iw9covwu7/guide.png"></span>
<div class="dropdown-content">
Bacon
Ribs
Steak
</div>
</div><div class="dropdown">
<span><img src="https://s12.postimg.org/aa9pluszh/resources.png"></span>
<div class="dropdown-content">
Bacon
Ribs
Steak
</div>
</div></div>
</div><div class="branchoverlay"></div><div class="contentholder">
<div class="maindiv"><p>Welcome and thank you for your interest in joining Hvalla, the following links have been provided for your convenience.
<h3>Required Reading</h3>
» The Rules — While you are not expected to commit these to memory, they are a required read.
» Setting and World Lore — An in-depth look at the world of Hvalla, from locations to the packs that inhabit it.
» Character Creation — All information pertaining to the creation of your character.
» How to Join — A detailed overview of the current joining process.
» Currency — An in-depth guide of Runestones and how to utilize them.
» FAQ — All frequently asked questions.
<hr>
<b>Core Concepts:</b>
<ul><li><span>Hvalla is a semi-realistic wolf art and roleplay community. Our goal is to stretch the boundaries of realism in a tasteful way, encouraging a more mature form of creativity in wolf RP. </span></li></ul><ul><li><span>We strive to provide a community that is inclusive and close-knit; no one should ever feel excluded, railroaded or otherwise on the fringes of a clique of close friends.</span></li></ul><ul><li><span>Characters in Hvalla may exhibit humanized aspects such as facial expressions and verbal communication similar to media such as Princess Mononoke, </span>The Jungle Book<span>, </span>Savva<span> etc., but overall should exhibit realistic behavior. </span></li></ul><ul><li><span class="bbcode_bold">Hvalla explores themes that are ideologically sensitive in nature.</span><span> We are always excited to involve new members in the community, however, if you find the exploration of dark themes such as murder, war, pillaging, abuse etc., to be outside of your comfort zone or you find yourself easily offended by aforementioned subjects, Hvalla may not be the community for you. Remember, this is creative writing, not real life.</span>
</li></ul></p></div></div>
<div class="rockfooter"></div> </div></div>
CSS:
/*BODY*/
.gr-body {
background: url(http://orig14.deviantart.net/8b57/f/2016/279/f/5/frontpagebackground_by_wulfghast-dak5apt.jpg);
background-size: 100%;
background-repeat: no-repeat;
background-color: #1c1119;
color: #545454;
}
.gr-top{
border: none;
margin: -5px 0px -10px 0px;
}
.gr-top img {
display: none;
}
h2 {
display: none;
}
.gr-top span {
display: none;
}
.tri {
display: none;
}
.gr1, .gr2, .gr3 {
display:none;
}
.bottom {
display: none;
}
.text {
margin-bottom: -38px;
padding: 0;
}
/*TEXT*/
p {
color: #3c281f;
font-family: 'montserrat', sans-serif;
font-size: 15px;
line-height: 1.4;
margin: 20px;
}
/*MENU AREA*/
.menu {
width: 64%;
height: 171px;
margin-left: auto;
margin-right: auto;
margin-top: 18%;
padding-left: 10%;
background: url('http://s15.postimg.org/zby726h7v/header.png');
background-repeat: no-repeat;
background-position: top-center;
background-size: 100% 70%;
position: relative;
z-index: 3;
}
.branchoverlay {
width: 74%;
height: 694px;
margin-left: auto;
margin-right: auto;
margin-top: -53px;
background: url('http://s15.postimg.org/n6ayvyzrd/branchoverlay.png');
background-repeat: no-repeat;
background-position: top-center;
background-size: 100% 70%;
position: relative;
z-index: 2;
}
.dropdowncontainer {
height: 30px;
width: 70%;
margin-left: auto;
margin-right: auto;
}
.dropdown {
position: relative;
display: inline-block;
width: 23%;
text-align: center;
margin-top: 30px;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #4a463b;
min-width: 120px;
padding-bottom: 20px;
}
.dropdown-content a {
color: #ffffff;
line-height: 2.5;
}
.dropdown-content a:hover {
color: #000000;
}
.dropdown:hover .dropdown-content {
display: block;
}
/*CONTENT*/
.contentholder {
width: 68%;
margin-left: auto;
margin-right: auto;
margin-top: -735px;
-moz-box-shadow: 0 20px 20px 5px #0a0a0a;
-webkit-box-shadow: 0 20px 20px 5px #0a0a0a;
box-shadow: 0 20px 20px 5px #0a0a0a;
background-color: #50463b;
position: relative;
z-index: 1;
}
.maindiv {
width: 85%;
margin-top: 4%;
margin-left: 5%;
margin-bottom: 400px;
position: relative;
z-index: 5;
padding: 20px 20px 20px 20px;
display: inline-block;
}
/*FOOTER*/
.rockfooter {
background: url(http://s17.postimg.org/is79jxd3z/footer3_by_wulfghast_dakd92b_1.png);
height: 1000px;
width: 100%;
background-position: bottom;
background-repeat: no-repeat;
background-size: contain;
margin-left: auto;
margin-right: auto;
margin-top: -1100px;
position: relative;
z-index: 4;
}
/*RESPONSIVE MOBILE*/
.da-media[mobile] .menu {
width: 74%;
padding-left: 0%;
}
.da-media[mobile] .dropdown {
margin-top: 35px;
width: 31%;
}
.da-media[mobile] .maindiv {
margin-left: 1%;
}
.da-media[mobile] .rockfooter {
margin-top: -1300px;
}
Thanks for any help and suggestions anyone can give!
You got z-index:4 causing your div into front try making it to 1 or remove your margin-top
body div#devskin13122897 .rockfooter {
background: url(http://s17.postimg.org/is79jxd3z/footer3_by_wulfghast_dakd92b_1.png);
height: 1000px;
width: 100%;
background-position: bottom;
background-repeat: no-repeat;
background-size: contain;
margin-left: auto;
margin-right: auto;
margin-top: -1100px;
position: relative;
z-index: 1;
Please remove the branchoverlay div which is just used to hold a background image and add the image in contentholder class
background: #50463b url(http://s15.postimg.org/n6ayvyzrd/branchoverlay.png);
Check this url: jsfiddle.net/pfayap45

BootStrap Responsive Background image with text on it is not working

I'm getting started with BootStrap 3 and trying to use a background image with text on it. At same time I want it to be reponsive but it seems there is some issue with the way I implemented it. I'm able to get it work for normal desktop but when I try to emulate on a mobile device, text goes outside of background image.
http://jsfiddle.net/cn5guyt4/2/
<div id="front-landing">
<div class="container jumbotron hero-unit">
<h2 class="h1"><span>"Sample Test"</span></h2>
<h3 class="-sub-title">
<span>"Sample Test text 2"</span>
</h3>
</div>
</div>
.hero-unit {
position: relative;
margin-bottom: 0;
margin-top: 15px;
background: url('http://1.bp.blogspot.com/-P5uqUWLgZmA/UtQDdtahipI/AAAAAAAAF3E/IgvARwfxAlw/s1600/seamless-stone-background.jpg') 50% 80% no-repeat;
background-size: 100%;
min-height: 700px;
}
.h1 {
font-size: 2.625em;
font-weight: 700;
letter-spacing: -0.03em;
margin-bottom: 0.571em;
margin-top: 2em;
text-align: center;
}
.-sub-title {
font-weight: 400;
text-align: center;
}
h2 span {
background-color: white;
}
h3 span {
background-color: white;
}
Can someone help me to figure out what am I doing wrong here ?
Thanks
In your hero-unit class, the background-size set to 100% but it should be cover instead. That made a huge difference: see bootply.
I think what you are really trying to do is get the jumbotron of bootstrap to have a background picture. Why is your jsfiddle code different from the code you posted here? there is a wild margin of difference. My fix is using the code above.
Working bootply
<div id="front-landing">
<div class="container jumbotron ">
<h2 class="h1"><span>"Sample Test"</span></h2>
<h3 class="-sub-title">
<span>"Sample Test text 2"</span>
</h3>
</div>
</div>
.h1 {
font-size: 2.625em;
font-weight: 700;
letter-spacing: -0.03em;
margin-bottom: 0.571em;
margin-top: 2em;
text-align: center;
}
.jumbotron{
background-image: url('http://1.bp.blogspot.com/-P5uqUWLgZmA/UtQDdtahipI/AAAAAAAAF3E/IgvARwfxAlw/s1600/seamless-stone-background.jpg');
background-size: cover;
}
.-sub-title {
font-weight: 400;
text-align: center;
}
h2 span {
background-color: white;
}
h3 span {
background-color: white;
}
you can set image as a background-image
.imageAndText img{
width: 100%;
background: no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
for text you can use col-xs-12 or work write individual media query

html - Div alignment issues

So I am currently making a website for a friend of mine and I have set the left and right margin to 80px. This works for everything but my main body. It seems that it expands past the right margin, and simply has a margin of 60px instead of 80px.
Here is a screenshot: http://i.imgur.com/XtRdlUv.png
EDIT: I cut off some of the left margin, sorry for the confusion
As seen with the red arrow, there seems to be an offset when their shouldn't.
Here is my code:
body {
background: url(image) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
text-align: center;
margin-left: 80px;
margin-right: 100px;
}
.wrapper {
padding-top: 10px;
text-align: left;
margin: 0px auto;
}
.mainbody {
width: 100%;
outline: #293135 solid;
background-color: #444444;
margin-top: 40px;
text-align: left;
padding: 20px;
color: #FFFFFF;
}
<div class="mainbody" style="text-align: center">
<font face="Arial, Helvetica, sans" size="4">
<h1 style="text-decoration: underline">Download</h1>
<p>Features Include:</p>
</font>
</div>
You don't need
width: 100%;
Since .mainbody is a block element, it will expand to fill all the remaining space.
Otherwise, adding it produces the problem because of the content-box sizing model.
body {
background: url(image) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
text-align: center;
margin-left: 80px;
margin-right: 100px;
}
.wrapper {
padding-top: 10px;
text-align: left;
margin: 0px auto;
}
.mainbody {
outline: #293135 solid;
background-color: #444444;
margin-top: 40px;
text-align: left;
padding: 20px;
color: #FFFFFF;
text-align: center;
font-family: Arial, Helvetica, sans;
font-size: 18px;
}
<div class="mainbody" style="">
<h1 style="text-decoration: underline">Download</h1>
<p>Features Include:</p>
</div>
It is likely because your .mainbody element is using the default content-box, which adds an extra left and right padding of 20px each on top of the 100% width. Therefore, the final computed width of the element would be 100% + 40px, which causes it to 'overflow' of sorts.
To fix this, simply declare box-sizing: border-box, i.e.:
.mainbody {
box-sizing: border-box;
width: 100%;
outline: #293135 solid;
background-color: #444444;
margin-top: 40px;
text-align: left;
padding: 20px;
color: #FFFFFF;
}
In fact, it is recommended that you use this rule: * { box-sizing: border-box;} as recommended here.
I think you're using old ways. Try this! .mainbody { width: calc(100% - 120px); }
This is your new css and JSFiddle link! http://jsfiddle.net/Leo4v9rc/
body {
background: url(image) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
text-align: center;
}
.wrapper {
padding-top: 10px;
text-align: left;
margin: 0px auto;
}
.mainbody {
width: calc(100% - 120px);
outline: #293135 solid;
background-color: #444444;
margin:40px auto 0 auto;
text-align: left;
padding: 20px;
color: #FFFFFF;
}