I have my margin and padding set to zero, but for some reason there is still about 200px of white space on each side of my css grid. When I place the css inside style tags on the .html document the content stretches the entire main axis, as it should. When I put the same exact css code in a .css file, the white space appears. Please help!
CSS Code:
body {
margin: 0;
padding: 0;
}
.container {
display: grid;
grid-template-columns: 1fr 5fr;
height: 100vh;
}
.box1 {
color: #dddddd;
background-color: #460000;
}
.box2 {
background-image: url("img/brick-bg-image.jpg");
}
Have you linked to your stylesheet in you HTML file? i.e. <link rel="stylesheet" href="style.css">?
You need to have your Stylesheet added in <head> element looking like so:
<link rel="stylesheet" href="style.css">
In case it is loaded you can open it in new window in the browser to check how it looks. Sometimes the path is incorrect or some other issue. (I do this sometimes to check my style if it is loaded correctly).
In case it is loaded and opening in new tab you may want to check the content. Sometimes the browser caches the css file and you need to hard-refresh with CTRL+F5 to clear the cache.
Hope this would help you. I don't see a reason if it works added in style to not work when added with css file.
I figured out my problem:
I was using the bootstrap.css style sheet. That was overriding the inline styles.
My question is how I via. the CSS can force my webpage to show a horizontal scroolbar on the frontpage.
I've triede looking for overflow-x: but can't seem to find the right place.
My webpage: http://holtumdata.dk
I've had customers who have trouble finding the "Download" page, when they're on computers with small screens. (open browser in window mode, to see what I mean.)
Thanks in advance!
Here looking at your page I can see that you have a HTML line like this
<div id="portfolio_viewport" style=" overflow: hidden; outline: none; cursor: -webkit-grab;" tabindex="5000">
Remove the overflow:hidden in element's style
but since CSS is generated from module we can override it locally by using script like
<style media="screen" type="text/css">
#portfolio_container {
overflow-x: scroll !important;
}
</style>
I check your site.. By applying overflow-x:scroll
your problem may be solved .
In CSS :
body{
overflow-x:scroll;
}
You put it in the html{} in your css file.
And a mozilla firefox specific one: -moz-scrollbars-horizontal
Like this:
html{
overflow-x:scroll;
}
I have created a responsive site with Twitter Bootstrap, however when I view the site in a screen resolution of 320x480 a horizontal scroll bar appears as the website seems to have an extra 20px-30px width. You can see this by scrolling too the right horizontally.
I have inspected the elements that form the page, however I can not work out what is causing this extra width - ideally I do not want any horizontal scrolling at the 320x480 resolution.
You can view the problem by changing the resolution to 320x480 in Google Chrome after inspecting an element.
Here is the site:
http://www.bestcastleintown.co.uk/wp/
It's the .jumbotron and .footer css rule margin-right: -20px; causing the problem.
Did you enabled the Bootstrap's responsive features?
http://twitter.github.com/bootstrap/scaffolding.html#responsive
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
Please note that bootstrap-responsive.css must be included and referenced on your website
Hope this helps.
You could try resetting lateral margins from -20px to 0 for header and footer tags
try this:
.footer{
width: 85%;
margin: 0 auto;
/* other css properties */
}
On this page, the main content is nested under <div id="container">. I've tried to center the content using:
#container {
margin: 0 auto;
overflow: auto;
width: 960px;
}
It works fine in Firefox, but not in IE8 or IE9. Is there a way to center the content in all modern browsers?
It works if you remove the display: table from your #stickyWrap element. Is there a reason you need that? It didn't seem to change anything else.
If you alternate the document mode under the Developer Tools in IE8 you can see that your site works just fine using IE8 standards mode, so try to force that mode using the following meta:
<meta http-equiv="x-ua-compatible" content="IE=8">
The other option would be to restructure your HTML to expose your #container outside of your #stickyWrap container, but that would take a bit of work.
Had this issue with Royal Slider buttons on a Wordpress theme and display: table worked like a charm.
I'm working on a printable list of events, the printer prints one page fine, but cuts off some of the text on the bottom, then it print a second blank page
I've tried everything I know but am at a loss.
In print.css, set overflow: visible instead of overflow: auto on div#content. That fixed it for me in Firefox at least. The definition of overflow auto is: "If overflow is clipped, a scroll-bar should be added to see the rest of the content" -- but scroll bars don't exist on printed pages.
I'm guessing that since the content div should span across multiple pages, the browser thinks "you're flowing outside your container and must be clipped with a scroll bar". The container in that case is the first page the content div appears on.
I know this is an old question but here's another, newer way this can happen.
Check if you're using display: flex; on the clipped element. It was the problem for me, setting it to block fixed it.
I found that setting display: inline on container divs also helped. Some of these great answers here have worked for me in certain situations while in others no.
<div class="container">
<div class="content-cutting-off-here">
Some long text that gets cut off at the end of the page...
</div>
</div>
Most people set containers to display block or inline-block. For me it was cutting off text, and setting it to inline circumvented that. This also makes width and height irrelevant for the offending container div; which I have found to be a nuisance when printing.
#media print {
.container {
display: inline;
}
}
Here is a great article that helped me with this solution.
If any of the containers you're trying to print are floated, they'll get cut-off like you're seeing.
In your print.css, make sure you turn off all the floating that you can without destroying your layout. It's a pain, but browser support for printing is weak at best.
Are you already using the print value for the media attribute for your stylesheet like
<link rel="stylesheet" href="print.css" media="print" />
You might also want to use page-break-before attributes for elements that you don't want to break.
I just resolved this problem in ie7. This was in a Sharepoint project, which had various table cells and/or divs set to height:100%. When printed, it would print long forms, the first page or 2 would print as usual, then blank pages instead of the rest.
In my print stylesheet, I set those tables & divs to height: auto, and now it prints fine.
I'm having a different problem in IE8 now. UGH!
if overflow:visible; not works, try overflow-y:visible;
(i had body{overflow-y:scroll;}, and body{overflow:visible;} in print.css not rewrited it...)
I fixed the problem by adding overflow:visible; and give it padding-right: 30px; to substitute for the scroll bars width.
I just ran into this issue and have been scouring the internet for a solution that fit my specific needs. In my case I had about 7 tables nested in a larger table. The only way I was able to get the entire web page to print and display in print preview correctly was to use page breaks. Page breaks are CSS properties that allow you to specify and/or force page breaks by attaching the property to block elements.
https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
just setting display: inline solved my same problem.
Reference link I got, https://www.bennadel.com/blog/851-fixing-divs-that-cause-content-truncation-when-printing.htm
I setup my print sheet to only print the modal content. My fix was to make the modal position: absolute;. My modal was originally position: fixed;.
For me setting overflow:visible; for body solved the problem.
body {
overflow: visible;
}
I've had this issue to. In my case, this was due to an
position: fixed;
Element. I changed this to
#media print{
position: relative;
}
Now I even see new elements that were behind my fixed element, and no cutting off at the bottom anymore.
If the items on the page are getting partially cut off, adding an :after element of 10px did it for me.
<div class="print-row">
<div class="print-items">
<div class="print-item"></div>
<div class="print-item"></div>
<div class="print-item"></div>
</div>
</div>
.print-items {
page-break-before: auto;
page-break-after: auto;
page-break-inside: avoid;
}
.print-item {
break-inside: avoid;
}
.print-item:after {
position: relative;
display: block;
min-width: 100%;
height: 10px;
width: 100%;
content: "";
}
for me, the issue was this meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1"/>
which putting any value other than 1 for initial scale solves my problem:
<meta name="viewport" content="width=device-width, initial-scale=0.8"/>