I have a ASP:MENU with some CSS styles applied to it. One of the options we specify on the table is that each element have a 'height' and 'line-height' of 15px. This looks fine in IE, but too cramped in Chrome. Additionally we apply 'border-bottom-style: dotted' to the element. In IE this dotted line is equal to the width of the table element. In Chrome it is the same width as the text.
I've examined the code for the page in Developer tools in Chrome and IE, and they're receiving the styles as required. Why do they display differently, is it simply an inherent difference in the way Chrome renders a site? If this is the case it may be that I need to use a different CSS style sheet, depending upon the browser, unless there is something else I can try?
<asp:Menu ID="menuSubLeft" runat="server" DataSourceID="sitemap_submenu"
MaximumDynamicDisplayLevels="1">
<StaticMenuStyle CssClass="clienthome_submenuMenu" />
<StaticMenuItemStyle CssClass="clienthome_submenuItemMenu" />
<StaticSelectedStyle CssClass="clienthome_submenuSelectedStyle" />
<StaticHoverStyle CssClass="clienthome_submenuHoverStyle" />
<DynamicMenuItemStyle CssClass="clienthome_dynamicMenu_Item" />
<DynamicHoverStyle CssClass="clienthome_submenuHoverStyle" />
<DynamicMenuStyle CssClass="dynamicMenu_style_left" />
<DynamicSelectedStyle CssClass="clienthome_submenuSelectedStyle" />
</asp:Menu>
.clienthome_submenuItemMenu
{
border-bottom:dotted 1px #5a57a6;
height:15px;
line-height:15px;
padding:2px 0px 2px 5px;
color:#5A57A6;
}
<table id="ctl00_ctl00_globalContent_menuSubLeft"
class="clienthome_submenuMenu ctl00_ctl00_globalContent_menuSubLeft_5 ctl00_ctl00_globalContent_menuSubLeft_2"
cellpadding="0"
cellspacing="0"
border="0">
<tr onmouseover="Menu_HoverStatic(this)"
onmouseout="Menu_Unhover(this)"
onkeyup="Menu_Key(this)" title="Allows client to change their account password" id="ctl00_ctl00_globalContent_menuSubLeftn0">
<td>
<table class="clienthome_submenuItemMenu ctl00_ctl00_globalContent_menuSubLeft_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;">
<a class="ctl00_ctl00_globalContent_menuSubLeft_1 clienthome_submenuItemMenu ctl00_ctl00_globalContent_menuSubLeft_3" href="/myprofile.aspx" style="border-style:none;font-size:1em;">My Profile</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
UPDATE: After hours of playing around with the CSS and getting nowhere/throwing everything else on the site out a colleague pointed me to a simple fix: I just added the following code to the code behind:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Page.Request.ServerVariables["http_user_agent"].ToLower().Contains("safari"))
{
Page.ClientTarget = "uplevel";
}
}
This is something like CSS PRECEDENCE
6.4 The cascade
Style sheets may have three different origins: author, user, and user agent.
Author. The author specifies style sheets for a source document according to the conventions of the document language. For instance, in HTML, style sheets may be included in the document or linked externally.
User: The user may be able to specify style information for a particular document. For example, the user may specify a file that contains a style sheet or the user agent may provide an interface that generates a user style sheet (or behaves as if it did).
User agent: Conforming user agents must apply a default style sheet (or behave as if they did). A user agent's default style sheet should present the elements of the document language in ways that satisfy general presentation expectations for the document language (e.g., for visual browsers, the EM element in HTML is presented using an italic font). See A sample style sheet for HTML for a recommended default style sheet for HTML documents.
If this is your case, just RESET your base styling in order to remove padding and margin for block and table elements.
Related
I am working an an email template and I am trying to use a checkbox to display additional information when the box is checked (for android Gmail client). I currently have a working setup that uses a button with focus to change the display of the content to inline. Once the user clicks the focus off the button the additional information goes back to display:none.
Sample Code of button Configuration
button.showDetails:focus + .moreInfo {display:inline!important;} //Toggles content on when focused to display moreInfo.
<button type="button" class ="showDetails" style ="//display:none; /* background:whitesmoke; outline:none; border:none; width:0px; height:0px;*/">Leasing Terms</button> <!!--Hide Button for GMAIL by styling CSS. Reveal in others with body CSS.-->
<table class ="moreInfo" width="240px" cellspacing="0" cellpadding="0" border="0" style ="display:none;">
<tr>
<td width="50%" align="center" style="font-size:.7em;">$269 a month lease for 36 months. 12,000 miles per year. $2,000 due at signing and no security deposit required. On approved credit. An extra charge may be imposed at the end of the lease term due to mileage overage. Price plus tax, title, and license.</td>
</tr>
</table>
According to campaign monitor https://www.campaignmonitor.com/css/ Android GMAIL does not support the :focus pseudo-selector. As a work around for android GMAIL I am trying to use a checkbox and use a combination of the attribute selector and general sibling selector. Is it possible to use an attribute selector to style a checkbox or in this case the sibling of that checkbox if the checkbox is checked?
Here is the example for checkbox.
<style>
input.showDetails[checked = "checked"] ~ .moreInfo {-webkit-display:inline!important;}
</style>
<input class= "showDetails" type="checkbox" >Disclaimer
<button type="button" class ="showDetails" style =" width:100%;display:none; /* background:whitesmoke; outline:none; border:none; width:0px; height:0px;*/">New Vehicles Disclaimer</button> <!!--Hide Button for GMAIL by styling CSS. Reveal in others with body CSS.-->
<p class="moreInfo" style="display:none">All prices plus tax, title, license, and doc fee. See dealer for details</p>
I did get the attribute selector and sibling selector to work when I placed the style tag at the bottom of the body tag, but only when the checkbox's default was set to checked. Anyway to use css to style a checkbox once it has been checked by the user? Any other methods that might have a similar effect?
Thanks
P.s. javascript and jquery cannot be used.
If the checkbox is checked , you can do this
.showDetails:checked {
margin-top:2%;
}
As far as I know, checked attribute of the checkbox corresponds to its defaultChecked DOM property, not checked, and doesn't reflect the change of the checked state. So [checked = "checked"] in CSS shouldn't reflect it, too, and has different meaning than :checked pseudo selector.
You can try to use something like
input.showDetails:not(:checked) ~ .moreInfo {display:none;}
that will hide the details in mail programs that support both :not() and :checked selectors (according to campaign monitor, Android 4 Gmail supports at least the first one), falling back to always visible details in programs that don't support any of them.
Alternatively, you can try HTML5 detail element, which has rather good support in WebKit-based products (I'd expect that products based on Android Web component should support it).
Here is the code I came up with to display additional content on focus without using a button or other input forms, and no javascript. It works fine enough. I did not find any solution other than just displaying all the information for android gmail. I used tabindex attribute on the span tag so it will get focus similar to an input element.
/*Toggles content on when focused to display moreInfo.*/
.showDetails:focus + table.moreInfo {
display:inline!important;
}
.buttonStyle:hover {
background-color: #215ace;
cursor: pointer;
}
<span tabindex="50" class="showDetails displayButton" style="outline:none; //display:none;" >
<table class="buttonStyle" width="80%" height="20px" bgcolor="#022b7f" style ="background-image: url(Links/Highlight-Button.png); background-repeat:repeat-x; color:#ffffff; border-radius:10px; border-style:outset; border-width:1px; border-color:navy;">
<tr>
<td align="center"><span>New Vehicle Disclaimer</span></td>
</tr>
</table>
</span>
<table class="moreInfo" width="100%" bgcolor="lightblue" style="display:none;">
<tr>
<td>All prices plus tax, title, license, and doc fee. See dealer for details</td>
</tr>
</table>
I have two servers... one is of the TEST. Other.. of the live (productions). Both is of SAME OS and with the same hardware (32 bits), and same .NETs (4).
In one the LIVE, my styles attributes... uninclused.
Example:
<asp:textbox runat=server width=250 id=ctl32 />
In ALL browser, but the #10, render becomes:
style="width:250px;"
BUT in the ie10, doesn't set the style, is this a bug of .NET?
first you should avoid doing inline style settings. But I think you are setting an attribute, which is a deprecated way to apply the width to an element, it should be in a style rule. So in your css file (please avoid inline styles) create a class to set your with:
.myInput250{
width:250px;
}
and in your webforms textbox declaration reference it:
There seems to be an issue with the width attribute of an ASP.NET TextBox being recognized properly by Internet Explorer 10. Instead of using the Width attribute, try this:
<asp:textbox runat="server" id="ctl32" style="width: 250px;" />
Being a customer service staff with limited access to basic html, I've been assigned a task that beyond my skill about making a decent page of highlight items, after series of search around, I somehow get things working, well, in firefox, when I load up the the same content in Chrome & IE, I found different problem and to my best effort, I have no idea what cause the problem...
You might first wish to look at the firefox version as it display perfectly as I wanted it to:http://jsfiddle.net/kitchellw/TR6v5
(and I don't know why the first line doesn't apply the CSS...)
In IE, the round corner gone, which I won't worry too much... but
padding is gone...
the lower table looks like a mess
I found a way to tackle the image border, just border=0
In chrome,
while the upper section looks ok, the content in lower table seems 'shifted' to right by a few pixels and no longer stay center
Here is the exact code for the problem table at the lower section:
<table class=highlightitem>
<tr>
<td height="200" valign="top" >
<center>
<a href="http://www.digitalbuydirect.com/index.php?route=product/category&keyword=DSC-TX30" target="blank">
<img width=234 src="http://www.digitalbuydirect.com/edm/eDM20130516/TX30.png" /></a>
</center>
</td>
</tr>
<tr>
<td height="200" valign="top" >
<font class=product><B>some text</b></font><br><br>
<font class=content>some text</font><br>
<br>
<font class=pricehighlight><B>price</font><BR>
<font class=content><s>other price</s></font>
</td>
</tr>
<tr>
<td align="right" height="50" valign="bottom" >
<img src="http://www.digitalbuydirect.com/edm/achieve/shopnow_35.png" /> </td>
</tr>
</table>
and finally, I know my code is complex by using multi-table to control the vertical position, and CSS is my friend here, but i were unable to get the 'shop now' icon station at the lower right corner with clickable url attach with it, I found a CSS background image with a display block for the url might work, but the display block still request at least 1 character, which I cannot afford on my image. Any hint or direction would be appreciated.
First of all, you should really clean up your deprecated code.
So far the things I've seen that are deprecated or not supported anymore are as follows:
<center> - Use CSS text-align:center; reference
<font> - Use another element like <p> coupled with CSS text styling
<td align="right"> - Use CSS float:right; reference
<td valign="top"> - Use CSS vertical-align:top; reference
As for your IE padding problem, take a look at this question. I'm not sure if that's applicable though, since you didn't include your CSS in the question, so I don't know how you implemented the padding you already have.
As for centering, using margin:0 auto; will work for statically positioned elements. For absolutely or fixed position elements I do this: #elementID{width:800px[specify width]; left:-400px[negative half of the width]; margin-left:50%;}
I am using Div in my website to display some links. It works fine in IE, but when i expand that div in firefox and google chrome it goes weird.
Can anybody help me to figure it out. I have googled it but i did not fine any useful solutions.
<td vAlign="top" align="center"><font>-</font></td>
<td align="left" >
<div align="left" style="margin:0 auto; padding:0; display:block;clear:both; position:relative;">
<A class="inkblue" href="javascript:expand(4);">Faculty & Staff</A
</div>
</td>
<td></td>
</tr>
<tr id="e4" style="DISPLAY: none">
<td></td>
This is the code for that section. Please let me know if anything required.
This is the link to site. open it in firefox or chrome and click the link
"Faculty & Staff" under "Campuses" .
I have gone through your site:
I saw that you are using below line double time. Insert this line only one time.
If your are trying to Override some classes then specify different css file name.
<link rel="stylesheet" type="text/css" href="css/nuonline.css">
To overcome your issue:
Currently on click of "Faculty, Events & Campus", you are doing style="display:inline". Rather than doing this way you can remove style attribute itself.
Example:
On click: Remove style attribute style="display:none" for id="e4" or id="e5" or id="e7"
To Reset (that is on next click): Add style attribute as style="display:none" for id="e4" or id="e5" or id="e7"
There is one blank <td></td> remove it and give colspan="2" to next td element
I have a client form which includes HTML served up from an iframe - I can't edit it. The only thing I can do is apply CSS edits.
I'm trying to apply a simple adjustment which would stack the <td>s in the form so
1. What is your age?
becomes
1.
What is your age?
If you right click the first question and Inspect Element you'll see the rather interesting DOM structure I get to work with. This example it looks like this:
<div id="Age" class="questionlabel">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<span class="questionnumber_questionlabel">1. </span>
</td>
<td>
<label class="required">What is your age?</label>
</td>
</tr>
</tbody>
</table>
</div>
When I inspect that <td> and add a display:table-row; it completely ignores me. This is in Chrome - I can replicate this DOM and get the CSS to do what I want in jsfiddle so I'm thinking there is a reset somewhere I can't see. I even tried display:table-row !important; to no avail. I can apply border:2px solid blue; no problem. I can apply display:none; no problem.
Any ideas as to what is going on here that would prevent this simple CSS param from working?
To re-iterate the ONLY thing I can do is apply CSS - No JavaScript and no HTML edits. Basically I pass in a CSS file in the url to the iFrame. That's all I get. Thanks!
EDIT: I apologize I had to remove the link to the example form on the live site.
Edit - screenshots had to be removed, but the solution is still valid.
Added this code to form-css.css, using Firebug. Beginning or end, it did not matter:
table#form_table div.questionlabel td {display: table-row !important;}
.questionnumber_questionlabel {margin: inherit!important;}
(Note: I reset that margin as the old one (-10px) was causing unsightly overlap.)