print.css is printing very small text - css

My print.css pages are printing out very small, super reduced and the text is like 6 pt.:
#charset "UTF-8";
/* CSS Document */
body {
background: white;
font-size: 12pt;
/* Change text colour to black (useful for light text on a dark background) */
.lighttext
color: #000
}
/* Remove unwanted elements */
#menu, #header, #nav, #prod, #home, #our, #work, #whole, #contact, #circle, #logo, #flower, #navblank, #bottom, .noprint
{
display: none;
}
#wrapper, #content {
width: auto;
margin: 0 5%;
padding: 0;
border: 0;
float: none !important;
color: black;
background: transparent none;
}
div#content {
margin-left: 10%;
padding-top: 1em;
border-top: 1px solid #930;
}
div#mast {
margin-bottom: -8px;
}
div#mast img {
vertical-align: bottom;
}
a:link, a:visited {
color: #520;
background: transparent;
font-weight: bold;
text-decoration: underline;
}
#content a:link:after, #content a:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
#content a[href^="/"]:after {
content: " (http://www.alistapart.com" attr(href) ") ";
}
Do not understand why - does anyone have any suggestions to correct the output of this print.css?

As pt stands for points being 1/72th of an inch I would hazard a guess that it may be down to screen size, although in reality it could be any number of things. We'd really need more information.
Have you tried using em's instead? They're the best way of dealing with font sizes.

What about an absolute value for font-size (instead of 90%) just to rule that out?

Check if is there is any script that modify inline styles, forgotten CSS that applies to all types of media. Try adding !important. Then check your printing options. If it is something like shrink to fit, then there is not much you can do in CSS. Also try printing with alternative browsers, maybe that will diagnosing.

Perhaps you have another stylesheet that is being loaded when printing? What does it look like in Print Preview?
It's possible you have another stylesheet that you don't intend to be loaded for printing but is being loaded for printing anyway. Check the 'media' attribute:
something like this will be loaded on screen or in print:
[link rel="stylesheet" href="css/style.css" type="text/css" media="all" /]
so will this:
[link rel="stylesheet" href="css/style.css" type="text/css" /]
And of course this is for print only:
[link rel="stylesheet" href="css/print.css" type="text/css" media="print" /]
To keep a stylesheet from being loaded for print, use something like this:
[link rel="stylesheet" href="css/print.css" type="text/css" media="screen, projection" /]
(NOTE: use angle brackets, not square brackets as I have above. Somehow 4 space indenting is not working for me)
More about media attribute types

You're missing a } to close your body declaration:
body {
background: white;
font-size: 12pt;
/* Change text colour to black (useful for light text on a dark background) */
}
.lighttext
color: #000
}

try pressing ctrl+0 you might have unknowingly reduced the font size on browser-side

Related

Internal CSS not overriding external CSS for class

I need my "column" class in the internal CSS to float center while the external CSS has it set to left.
Here is my CSS file:
body { text-align: center; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }
#report { width: 1269px; margin: auto; float: left;
}
div.column{ margin-top: 10px; padding: 0px 0px; float: left; }
div.first{ padding-right: 8px; border-right: 1px grey solid; }
div.second{ margin-left: 8px;
}
...
Here is my HTML with internal CSS:
<!DOCTYPE html>
<html>
<head>
<title>Dual Server Report</title>
<link rel="stylesheet" type="text/css" href="ServerReport.css">
<style type="text/css">
div.column{ float: center; }
</style>
</head>
<body>
<div id="report">
<h1>Automated PowerShell Install Report</h1>
<h2>This report was ran: 07/07/2015 09:03:21</h2>
<div class="column">
...
I checked out these three similar questions but nothing I tried worked.
Internal Stylesheet NOT overriding External stylesheet?
“Inner” CSS Not Overriding “Outer” CSS
Overriding External CSS
Edit:
I remembered looking up the "float" property yesterday but I did not remember what I found; I feel pretty silly for posting this before going to double check. It makes sense that float would not have a center property.
I'll leave this up in case anyone in the future makes a similar mistake. Thanks to everyone who answered for being so respectful in pointing out this error I should have found on my own.
The property value of float: center does not exist.
The float property has four values: left, right, none, and inherit.
The only valid values for float are: left, right, none, inherit.
So this code will be skipped and not override the css file.
Please look here for more information on the float property.
There is nothing like float: center in CSS
Another way to do it
Change your CSS under the html page
div.column
{
float: none;
margin: auto;
width: 200px; /* set the width (Except 'auto') */
}

Icon with overhead label - how to get both to respond to hover, with CSS?

I've looked everywhere for a solution to this so I don't really expect it to be simple.
I want to display an icon with an overhead text label. I'd like the text to respond to hover, whether the cursor is positioned over the text OR over the icon image.
The closest example I can find is at this link http://www.sencha.com/forum/showthread.php?122028-Label-with-icon
which gives the following CSS solution:
Label l = new Label("My Text");
l.addStyleName("my-label");
#CSS
.my-label {
background:url(my-icon.png) no-repeat right center;
padding-right:20px;
}
But my CSS skills aren't good enough - I haven't had much success in adapting this to an above-centered label instead of a centered label to the left of the icon image.
Would anyone like to give it a shot for me?
Additional Info:
Here's what I have now - which isn't working, the "display: block; doesn't seem to let me use a background-img attribute ...
CSS:
.blogicon {
width: 70px;
text-align: center;
background-img:url("http://dispatchesusa.typepad.com/the_dov_blog/link-images/bookmark.png") no-repeat bottom center;
display: block;
padding-top: 4px;
padding-bottom: 90px;
}
HTML:
/* <h6 class="blogicon">Blog</h6> */
If you want to display the text above the icon, You can change the CSS to be:
.my-label {
background:url(my-icon.png) no-repeat bottom center;
padding-bottom:20px; /* this should be >= the icon's height */
}
It would be better if we could see your HTML, too, or at least a screen shot of what you are picturing, but this should be pretty easy. You can either wrap an <a> around the text and icon and set :hover rules, or you could add the text via the :before pseudo element to the <a>, which can be styled for both hover and non-hover states.
EDIT:
Now that we have a better idea of what you want, here's how you could do it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style media="all">
.blogicon {
width: 70px;
text-align: center;
backgrond: #f7f7f7;
padding-top: 4px;
}
.blogicon a {
display: block;
background:url("http://dispatchesusa.typepad.com/the_dov_blog/link-images/bookmark.png") no-repeat 50% 100%;
padding-bottom: 90px;
color: blue;
text-decoration: none;
font-weight: bold;
}
.blogicon a:hover, .blogicon a:focus {
color: red;
}
</style>
</head>
<body>
<div class="blogicon">Blog</div>
</body>
</html>
I have taken the liberty to change <h6> to <div>, as this probably is not a true heading. But of course, you can change this back if you want, but it's rare to need an <h6>, so I suspect you are using it for presentational reasons, which is to be avoided. It's easy enough to set the font-weight of the link to bold, as shown.

CSS what is the meaning of this code snippet? UPDATED

UPDATE
In my style sheet I have a conflict with these snippets. If I keep this one
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
then, the gradient effect of the one below works, but the header banner is displaced towards the right. If I remove that, the header banner positions itself correctly, but the gradient effect of the code below does not work :/
body {
background-image:url('../assets/uploads/miweb/gradient2.png');
background-repeat:repeat-x;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
width:600px;
height:500px;
margin: 0 auto;
}
a {
UPDATE II
These 3 lines
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
have a huge impact on the rest of the page
They make this code:
body {
background-image:url('../assets/uploads/miweb/gradient2.png');
background-repeat:repeat-x;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
width:600px;
height:500px;
margin: 0 auto;
}
be effective. If I remove those 3 lines, the gradient effect will not take effect and the font letters will not be of that family but the standard times roman. However, the negative effect is, like I said, that it displaces to the right a banner that I have as header
I have one header page, one controller and one view and the style sheet to which I have a link in the View
Like the others have said the code doesn't affect the positioning of the elements. Only way that it can affect the header would be if that piece of code is not treated as css at all. Check if the code is in the correct style tags.
The moz is for Firefox and as stated already its for styling. Are you using IE? as if so Id suggest trying alternate browser as well as IE has issues with the double colon which is for css3(no suprise there). have a look here
as I used this when I first came across these and it described them well.
That code shouldn't affect what you're doing. It is code that will change the background colour and text colour of text when it is selected by the user using their mouse.
Could you give us an example link of this happening with it commented out, please?
EDIT
What is the center: attribute supposed to be doing? It isn't valid CSS...

CSS is not being applied after changes

I have problem where I can't apply the style in CSS in my ASP.NET MVC application.
The behavior is it applies for the first time and then the subsequent changes to the CSS is not getting reflected in my _Layout.cshtml. I am not sure what I am missing here.
CSS file
body
{
font-size: .85em;
font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif;
color: #232323;
background-color: #fff;
}
header,
footer,
nav,
section {
display: block;
}
/* Styles for basic forms
-----------------------------------------------------------*/
fieldset
{
border:1px solid #ddd;
padding:0 1.4em 1.4em 1.4em;
margin:0 0 1.5em 0;
}
legend
{
font-size:1.2em;
font-weight: bold;
}
textarea
{
min-height: 75px;
}
.editor-label
{
margin: 1em 0 0 0;
}
.editor-field
{
margin:0.5em 0 0 0;
}
/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error
{
color: #ff0000;
}
.field-validation-valid
{
display: none;
}
.input-validation-error
{
border: 1px solid #ff0000;
background-color: #ffeeee;
}
.validation-summary-errors
{
font-weight: bold;
color: #ff0000;
}
.validation-summary-valid
{
display: none;
}
#Header
{
color:white;
padding:1px;
}
#Content
{
float:left;
margin:10px;
}
#SideBar
{
float :left;
margin:10px;
padding :10px;
border: dotted 1px red;
width:180px;
font-style:italic;
}
#Footer
{
text-align:center;
clear:both;
}
For example I changed "border" in #SideBar from red to black. But it always show red. I might be doing something fundamentally wrong here.
_Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<title>#ViewBag.Title</title>
<!--link href="#Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />-->
<link href="#Url.Content("~/Content/SiteStyle.css")" rel="stylesheet" type="text/css" />
<script src="#Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
</head>
<body>
<div id="Header" style="background-image: url('/Content/Images/Banner_Final3.png'); background-repeat:no-repeat; width :1500px; height : 150px;" >
</div>
<div id="SideBar">
#Html.Partial("UserControls/UserLogin", new AlanBeezLab.Models.LoginModel())
</div>
<div id="Content">
#RenderBody()
</div>
<div id="Footer">
<p>Copyright © XXXXXXX</p>
</div>
</body>
</html>
However, if rename the physical file and change the reference in _Layout.cshtml, I could see the changes I made.
Please help.
Thanks
Hit the Ctrl-F5 for reloading the page without using the cached contents
The browser can cache static files such as CSS files.
If you update a CSS file and the change does not appear when you browse, try using CTRL-F5 within your browser.
This will work when anything else won't, like in my case:
Credit goes to: atticae
You can append a random query parameter to the stylesheet url (for example via javascript or server side code). It will not change the css file that is being loaded, but it will prevent caching, because the browser detects a different url and will not load the cached stylesheet.
<link rel="stylesheet" type="text/css" href="http://mysite/style.css?id=1234">
Unfortunately ctrl+f5 does not work for me. I have to go to Chrome: F12 -> Network tab -> right click within white area where all the get and post records are -> Clear browser cache. Now if you press ctrl + f5 or just f5 it should work.
In my case the problem was I had a resource style file which was referring by the code
string location = Page.ClientScript.GetWebResourceUrl(typeof(PageBase), "MyNS.Common.Web.Base.CommonStyle.css");
LiteralControl include = new LiteralControl(string.Format(tempLink, location));
When I change / add some style in the file it was not reflecting in the CommonStyle.css
it was not reflecting in the web page even after clearing the cache(ctrl + f5 , ctrl + shift + f5)?
On my analysis I found the reason was -
stop the debugging, rebuild the solution and run it again so that all
the web resource styles load once again, simply clearing the cache as
we does normally for any html change will not help,after doing this my
change in the style got reflected in the web page and it fixed my problem.

Outlook rendering problem, rendering text too large

I'm trying to create a newsletter standard for our org and having problems with Outlook rendering the text too large.
Here is the css section of the page
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 75%;
background: url(http://www.blah.com/stuff.gif);
}
a {
color: #f24c22 !important;
}
a:visited {
color: #f24c22 !important;
}
a:hover {
color: #3d7ac5 !important;
}
table {
background: #ffffff;
}
h1 {
font-size: 1.3em;
}
h2 {
font-size: 1.2em;
color: #494949;
padding-top: 0 !important;
margin-top: 0 !important;
}
h3 {
font-size: 1.1em;
color: #12377c;
}
p {
padding-top: 0 !important;
margin-top: 0 !important;
color:#333333;
}
.style1 {color: #333333}
.style2 {color: #12377c}
.style3 {
font-size: smaller;
color: #666666;
}
Any suggestions why this might be caused?
Have you tryed using main *{font-size: 12pt;} ?
Outlook by default uses Trident, IE's engine for incoming mail, and Word HTML rendering engine for outgoing mail... Until Office 2007, and people hate it.
Now, it uses Word 2007's rendering, wich is rather lacking. On microsoft's page you can see that de body element doesn't support the style attribute.
If you want to set a specific size for you fonts, then you should probably use a fixed size type like pt. Rather than a variable one like em/%
See here for what I mean.
Many mail readers strip the "body" tag from any email received, or disregard styles applied to this element. Try applying the font size to an enclosing div.
abstracted the font size to smaller, which I found at standard viewing to be the equivalent size. Rewrite page in div's considering it's a basic template, refered to the ID's of the divs in order to render, worked fine. Tested it on various email accounts including gmail, hotmail and rendered through outlook. Outlook was the only problematic one, where the same page refferencial links fail.
Add these metatags and you will find that Word / Outlook "magically" renders the page (including images) the correct size:
<meta name="ProgId" content="Word.Document" />
<meta name="Generator" content="Microsoft Word 12" />
<meta name="Originator" content="Microsoft Word 12" />
I have no idea why Outlook does this, most corporate emails I get look terrible in Outlook - however, with these tags, the ones I send look pristine.

Resources