Current location: Hot Scripts Forums » General Web Coding » CSS » strange CSS issue


strange CSS issue

Reply
  #1 (permalink)  
Old 06-06-07, 04:50 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
strange CSS issue

I have the following HTML (CSS in head):

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
#page {
	width: 700px;
	margin: 0 auto;
}


#main {
	width: 500px;
	overflow-x: hidden;
}

</style>
</head>

<body>
<div id="page">
	<div id="main">
	<a href="http://webldsjfhjsdhjhgjhdfjkhgjkdfhsjgkhjkghsdjkhgjksdhjkghdjkfshgjkhdfsjkghjkdfhgjkhdfjkghjkdfhgkjdhfsjkghdfjkhgjkdfhkghsd.com">http://webldsjfhjsdhjhgjhdfjkhgjkdfhsjgkhjkghsdjkhgjksdhjkghdjkfshgjkhdfsjkghjkdfhgjkhdfjkghjkdfhgkjdhfsjkghdfjkhgjkdfhkghsd.com</a>
	Much much text ... More than A4 paper.
	Much much text ... More than A4 paper.
	Much much text ... More than A4 paper.
	Much much text ... More than A4 paper.
	......
        ......
</div>
</div>

</body>
</html>
Before (without overflow-x: hidden) : http://img178.imageshack.us/img178/7489/beforeox4.jpg
After (with overflow-x: hidden enabled) : http://img178.imageshack.us/img178/8748/afterbm0.jpg

The "After" example do what exactly I need, cut the long link name, but I have a problem. With "overflow-x: hidden" enabled I see the following problem at Print Preview ( Mozilla Firefox) : http://img215.imageshack.us/img215/793/printkj4.jpg

Any idea how to solve this problem ? I appreciat any help !

Thanks
Reply With Quote
  #2 (permalink)  
Old 06-06-07, 07:36 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
Have you tried actually printing it? Maybe it's just a problem with the print preview.
__________________
Jack Bauer makes Chuck Norris cry
Reply With Quote
  #3 (permalink)  
Old 06-06-07, 08:54 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
Yes printing work but I don't know why I see the strange issue in Print Preview.. I think a solution need to exist.
Reply With Quote
  #4 (permalink)  
Old 06-06-07, 10:17 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
I think CSS by default use media="all", and this media cause the problem.

I need to specify media="screen" and everything work fine.. The overflow-x exist only on screen.

Reply With Quote
  #5 (permalink)  
Old 06-06-07, 04:33 PM
jfulton's Avatar
jfulton jfulton is offline
Community VIP
 
Join Date: Apr 2006
Location: Los Angeles, CA
Posts: 660
Thanks: 0
Thanked 0 Times in 0 Posts
I ran into a similar problem before...best bet: stay away from floats and overflow when creating print styles.

Here are some good links:
http://www.contractwebdevelopment.co...ntent-overflow
http://css-discuss.incutio.com/?page=PrintStylesheets
Reply With Quote
  #6 (permalink)  
Old 06-07-07, 03:26 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
Exist a way to disable the overflow in print.css file?

For example this style sheet has overflow:

HTML Code:
<style type="text/css" media="all">@import "themes/mytheme/style.css";</style>
And this is a separate style sheet for printing:

HTML Code:
<style type="text/css" media="print">@import "themes/mytheme/print.css";</style>
Thank you!

Last edited by Christian; 06-07-07 at 03:28 AM. Reason: Please use [HTML] tags when posting HTML code.
Reply With Quote
  #7 (permalink)  
Old 06-07-07, 07:03 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
Is that a question? Because you already gave the answer yourself: 2 separate css files. In the one for print, you can remove the overflow thing.
__________________
Jack Bauer makes Chuck Norris cry
Reply With Quote
  #8 (permalink)  
Old 06-07-07, 07:33 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks I solve the problem

Jfulton I use the following in print.css to override style.css :
CSS Code:
  1. #main {
  2.     overflow-x: visible !important;
  3.     float: none;
  4. }

Last edited by UnrealEd; 06-07-07 at 10:59 AM. Reason: please use the [highlight=CSS] wrapper when posting css code
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Issue in Firefox TheScreenSaver24 CSS 3 01-14-07 05:04 AM
css autoheight issue Rollo Tamasi CSS 2 07-04-06 11:11 PM
css issue darkcarnival CSS 4 10-11-05 08:35 PM
very strange functions issue jolac PHP 3 05-13-04 01:54 AM


All times are GMT -5. The time now is 02:03 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.