In my application I am reading an HTML page to a string. HTML Page contains many tags, new lines & many other characters.
<style type="text/css">
h3{
font-weight:bold;
line-height:18px;
font-family:Arial;
font-size:12px;
text-align:justify;
color:black;
background-color:transparent;
width:280px;
margin:0;
}
body{
font-weight:normal;
line-height:18px;
font-family:Arial;
font-size:12px;
text-align:justify;
color:black;
background-color:transparent;
width:280px;
}
</style>
I want to replace this string like following.
When we NSLog above HTML page, it will print as above looks. But What I want to NSLog is as follows
\t\t<style type="text/css">\n\t\t\th3{\n
font-weight:bold;
line-height:18px;
font-family:Arial;
font-size:12px;
text-align:justify;
color:black;
background-color:transparent;
width:280px;
margin:0;
}
body{
font-weight:normal;
line-height:18px;
font-family:Arial;
font-size:12px;
text-align:justify;
color:black;
background-color:transparent;
width:280px;
}
</style>
I mean including backslash characters. Is it possible? The reason behind this - I want to replace above style dynamically - but for replacing above I must have source to replace - How to get source including \n&\r characters ?
Look at the NSString reference. You'll need something like:
string = [oldString stringByReplacingOccurrencesofString: #"\n" withString: #"\\n"];
// repeat for \t and \r
Related
I am building an html template for a client which will create a drag and drop builder in mailchimp.
I have used the mso-line-height:exactly attribute globally to control erratic line height applied by Outlook.
However - because of this, when the client inserts an image into the body text using the 'insert image' text editor, the images is clipped at the line height of the text - for example if the line height is 20px, the image only shows the bottom 20px.
The solution I have been provided through research is that I have to remove the mso-line-height attribute globally and only apply it in the html code when I really need it - though this is not something a client can maintain.
How can I remove this attribute on images only? I want the exactly rule to be in place until such time as an image is inserted at which point is it m removed.
I have tried
img {
border:0 !important;
outline:none !important;
display:block !important;
mso-line-height-rule:at-least !important;
mso-height-source:userset !important;
}
And also setting a 'min-height:insert image height !important' manually in the code editor inside the mailchimp interface but nothing works.
At the moment it seems like you only have 2 options
1 - you have correct line height but clients can never insert images amongst the text (the have to be table cells pre-designed to have images in them)
OR
2 - you have incorrect line height and non-clipped images but the ability to insert them when you want.
Is there a solution to this that does not involve editing the html each time but can be handled in in the css?
here is my initial styling
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if gte mso 15]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="telephone=no" name="format-detection">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<title>template</title>
<style type="text/css">
body{
margin:0 !important;
padding:0 !important;
-webkit-text-size-adjust:100% !important;
-ms-text-size-adjust:100% !important;
-webkit-font-smoothing:antialiased !important;
}
/*
#tab Button
#section background-Colour
*/
.button{
/*#editable*/background-color:#e5e5e5 !important;
/*#editable*/color:#000000 !important;
height:43px !important;
margin-right:0 !important;
font-size:15px !important;
padding:0 5px !important;
}
/*
#tab Button_2
#section background-Colour
*/
.button_2{
/*#editable*/background-color:#e5e5e5 !important;
/*#editable*/color:#000000 !important;
margin-right:0 !important;
font-size:15px !important;
padding:0 5px!important;
}
a{
text-decoration:none !important;
color:black !important;
}
span.red-2{
color:#bc3434 !important;
}
span.white-force {
color:#ffffff !important;
text-decoration: none;
}
.white-force a {
color:#ffffff !important;
text-decoration: none;
}
img{
border:0 !important;
outline:none !important;
display:block !important;
}
table{
border-collapse:collapse;
mso-table-lspace:0;
mso-table-rspace:0;
}
td{
border-collapse:collapse;
mso-line-height-rule:exactly;
}
a,span{
mso-line-height-rule:exactly;
}
.ExternalClass *{
line-height:100%;
}
.white a{
color:#ffffff;
text-decoration:none;
}
.white1 a{
color:#333333;
text-decoration:none;
background-color:#333333;
}
.white2 a{
text-decoration:none;
}
.black a{
text-decoration:none;
}
.black3 a{
text-decoration:none;
}
.black2 a{
text-decoration:none;
}
.red a{
text-decoration:none;
}
.grey a{
text-decoration:none;
}
.grey1 a{
text-decoration:none;
}
.applewhiltelink a{
color:inherit !important;
text-decoration:none !important;
}
.video img{
width:100%;
height:auto;
}
.mcnTextContent img{
height:auto !important;
}
#media only screen and (min-width:481px) and (max-width:599px){
table[class=wrapper]{
width:100% !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
table[class=main_table]{
width:100% !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=pad_side]{
padding-left:14px !important;
padding-right:14px !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=hide],br[class=hide]{
display:none !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
img[class=full_img]{
width:100% !important;
height:auto !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=text],td[class=black],td[class=black2],td[class=red],td[class=white],td[class=white1],td[class=white2],td[class=grey], td[class=white-force]{
text-align:center !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=pad_bottom]{
padding-bottom:30px !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=pad_top],
td[class=pad_top_split]{
padding-top:30px !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=fix_height]{
height:30px !important;
}
} #media only screen and (min-width:481px) and (max-width:599px){
td[class=video] img{
width:100% !important;
height:auto !important;
}
} #media only screen and (max-width:480px){
table[class=wrapper]{
width:100% !important;
}
} #media only screen and (max-width:480px){
table[class=main_table]{
width:100% !important;
}
} #media only screen and (max-width:480px){
td[class=pad_side]{
padding-left:14px !important;
padding-right:14px !important;
}
} #media only screen and (max-width:480px){
td[class=hide],br[class=hide]{
display:none !important;
}
} #media only screen and (max-width:480px){
img[class=full_img]{
width:100% !important;
height:auto !important;
max-width: none !important;
}
} #media only screen and (max-width:480px){
td[class=text],td[class=black],td[class=black2],td[class=red],td[class=white],td[class=white1],td[class=white2],td[class=grey],td[class=white-force]{
text-align:center !important;
}
} #media only screen and (max-width:480px){
td[class=pad_bottom]{
padding-bottom:30px !important;
}
} #media only screen and (max-width:480px){
td[class=pad_top],
td[class=pad_top_split]{
padding-top:30px !important;
}
} #media only screen and (max-width:480px){
td[class=fix_height]{
height:30px !important;
}
} #media only screen and (max-width:480px){
td[class=video] img{
width:100% !important;
height:auto !important;
}
}
#media only screen and (max-width:480px){
td[class=pad_top_split]{
padding-top:0 !important;
}
}</style></head>
*edit
Each block that contains text (but may not necessarily end up with an image in it, has the class .grey - I tried these options but to no avail
.grey img {
line-height: 100px (random but taller then the test image)!important;
}
And also
.grey img {
line-height:unset !important;
}
I just want any images inserted amongst text to ignore the surrounding line-height.
here is an example block
<table width="650" border="0" cellspacing="0" cellpadding="0" align="center" class="wrapper" mc:repeatable mc:variant="text block" style="table-layout:fixed;margin-left:auto;margin-right:auto;">
<tr>
<td valign="top" bgcolor="#000000">
<table width="650" border="0" cellspacing="0" cellpadding="0" align="center" class="wrapper">
<tr>
<td width="50" align="center" class="hide"> </td>
<td valign="top" class="pad_side">
<table width="550" border="0" cellspacing="0" cellpadding="0" align="center" class="wrapper">
<tr>
<td valign="top" height="40" class="fix_height"> </td>
</tr>
<tr>
<td align="center" valign="top" style="font-family:Arial, sans-serif;font-size:15px;line-height:25px;color:#000000;background-color:#000000;" mc:edit="lorem_ipsum">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vitae interdum ligula. Pellentesque feugiat ligula ligula, in interdum dolor aliquet et.</td>
</tr>
<tr>
<td valign="top" height="40" class="fix_height"> </td>
</tr>
</table>
</td>
<td width="50" align="center" class="hide"> </td>
</tr>
</table>
</td>
</tr>
</table>
Try mso-line-height-rule: at-least on your images. It's essentially the opposite to mso-line-height-rule: exactly.
This blog post might offer some more insight.
In my own builds I add this Outlook conditional style block below my other embedded styles. Then on my inline styles, I avoid using mso-line-height rule and only set font-size/line-height as normal
<!--[if mso]>
<style>
td,th,p,a,h1,h2,h3,h4,h5,h6 {
mso-line-height-rule: exactly;
}
<style>
<![endif]-->
For some reason I cannot get the text in my middle column (of three columns) to respond to any classes or styles I apply to it. I'm just trying to slide the text in the middle column over to the right a little bit.
CSS (stylesheet):
#footer-address {
font-size:20px;
padding-left:20px;
}
#nav-foot{
border:1px solid #ccc;
border-width:1px 0;
list-style:none;
margin:0;
padding:0px;
text-align:left;
font-size:12px;
}
#nav-foot li{
display:inline;
}
#nav-foot a{
display:inline-block;
padding:20px 0 20px 0;
}
#nav-social {
border:1px solid #ccc;
border-width:1px 0;
display:inline;
list-style:none;
margin:0;
padding:0px;
float: left;
}
#nav-social li{
display:inline;
}
#nav-social a{
display:inline-block;
padding:20px 0 20px 0;
}
HTML:
<div style="width:30%; float:left; margin: 10px 0 10px 0; position:relative;">
<ul id="nav-foot">
<li>About Us</li>
<li>Jobs</li>
<li>Contact Us</li>
</ul>
</div>
<div id="footer-address" style="width:30%; float:left; margin: 10px 20px 10px 20px; position:relative;">
375 6th St. </br>
Atlanta, GA 30308 </br>
Phone: 404-981-3934 </br>
Email: admin#perimetermaids.com
</div>
<div style="width:30%; float:left; margin: 10px 0 10px 0; position:relative;">
<ul id="nav-social">
</i>
<li></i></li>
<li></i></li>
<li></i></li>
<li></i></li>
</ul>
</div>
Sorry if the code is sloppy or the formatting of my question, however, I'm really scratching my head as to why this won't work.
My URL is http://perimetermaids.com/test if anybody needs that as well. This is for the black footer area. Thanks for the help, and hope you all have an awesome weekend!
can anyone tell me how I can change the style of the draggers in a UIBinder template for the SplitLayoutPanel.
Here is my MainMenu.ui.xml:
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style src="Resources/GlobalStyles.css" />
<g:SplitLayoutPanel width="100%" height="100%" styleName='{style.splitLayoutPanel}'>
<g:north size="100">
<g:HTMLPanel/>
</g:north>
<g:west size="250">
<g:HTMLPanel/>
</g:west>
<g:center>
<g:HTMLPanel/>
</g:center>
<g:south size="50">
<g:HTMLPanel
styleName='{style.footerPanel}'>
<div>
Contact us
Privacy
About
</div>
</g:HTMLPanel>
</g:south>
</g:SplitLayoutPanel>
</ui:UiBinder>
The Resources/GlobalStyles.css looks like this:
body,table {
font-size: small;
}
body {
font-family: Helvetica, Arial, sans-serif;
color: #000;
background: #red;
}
.splitLayoutPanel {
.gwt-SplitLayoutPanel-HDragger {
background:#d0e4f6;
cursor: col-resize;
}
.gwt-SplitLayoutPanel-VDragger {
background: #d0e4f6;
cursor: row-resize;
}
}
.footerPanel {
margin-left: 11px;
padding: 10px;
border-top: 2px solid #5693d6;
text-align: right;
}
What's wrong here? My draggers are not visible and there is no cursus change.
I think GWT doesn't like the nesting. So rewritting the css as follows should make it work:
.splitLayoutPanel .gwt-SplitLayoutPanel-HDragger {
background:#d0e4f6;
cursor: col-resize;
}
.splitLayoutPanel .gwt-SplitLayoutPanel-VDragger {
background: #d0e4f6;
cursor: row-resize;
}
Also GWT will probably complain about the .gwt- styles, in that case the following lines in your css:
#external .gwt-SplitLayoutPanel-HDragger;
#external .gwt-SplitLayoutPanel-VDragger;
I have the same issue that is asked (and resolved) in this post. However, the solution(s) offered doesn't work for me. I tried both -webkit-text-size-adjust: none and <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> to no avail.
It is a simple HTML page that is text-only
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet">
<title>Pastrami fugiat pork tail ut</title>
</head>
<body bgcolor="#000000" link="#FFFFFF" vlink="#FFFF00">
<h1>Pastrami fugiat pork tail ut</h1>
<p>Pancetta bresaola ham, brisket short ribs tri-tip sed cillum turkey pork loin corned beef venison tail.</p>
</body>
</html>
The CSS
html
{
-webkit-text-size-adjust: none;
}
#font-face{
font-family:"Fertigo";
src: url(Fertigo.otf) format("opentype");
}
body {
padding:0;
margin:1cm;
font-family:"Fertigo", "Georgia";
font-size:56px;
line-height:1.5em;
color:#FFFFFF;
text-align:left;
text-decoration:none;
padding: 0px;
}
h1 {
font-family:"Fertigo", "Helvetica";
color:#FFFFFF;
text-decoration:none;
font-size:1.25em;
font-weight:normal;
margin:0px;
padding:5px 0px 5px 5px;
line-height: 1.5em;
}
h4 {
font-family:"Courier New", "Georgia";
font-size:1em;
color:#FFFFFF;
margin:0px;
padding:0px;
font-weight:normal;
line-height: 1.5em;
}
Try putting your webkit in the body and to every element within body and test it with standard font first like:
body * {
margin:1cm;
font-family:"Georgia";
font-size:56px;
line-height:1.5em;
color:#FFFFFF;
text-align:left;
text-decoration:none;
padding: 0px;
-webkit-text-size-adjust: none;
}
Try this:
body {
padding:0;
margin:1cm;
font-family:"Fertigo", "Georgia";
font-size:56px !important;
line-height:1.5em;
color:#FFFFFF;
text-align:left;
text-decoration:none;
padding: 0px;
-webkit-text-size-adjust: none !important;
}
h1 {
font-family:"Fertigo", "Helvetica";
color:#FFFFFF;
text-decoration:none;
font-size:1.25em !important;
font-weight:normal;
margin:0px;
padding:5px 0px 5px 5px;
line-height: 1.5em;
}
h4 {
font-family:"Courier New", "Georgia";
font-size:1em !important;
color:#FFFFFF;
margin:0px;
padding:0px;
font-weight:normal;
line-height: 1.5em;
}
#media only screen and (min-device-width : 320px) and (max-device-width : 1024px) {
html {
-webkit-text-size-adjust: none !important;
}
}
body * { -webkit-text-size-adjust: none; }
seems to work whereas
* { -webkit-text-size-adjust: none; }
..doesn't, interesting.
I am trying to center a TabLayoutPanel in a uibinder and having no luck whatsoever. As you can see below, I've tried every CSS trick I can think of. Can anyone assist?
<ui:style>
.gwt-TabLayoutPanel {
vertical-align: middle;
text-align: center;
margin-left: auto;
margin-right: auto;
border-top: 1px solid #666;
border-left: 1px solid #999;
border-right: 1px solid #666;
}
</ui:style>
<g:VerticalPanel ui:field="userInterfacePanel" width="100%">
<mapmaker:MapBox ui:field="mapBox"/>
<g:TabLayoutPanel barHeight="20" ui:field="interfaceTabs" height="300px" width="80%" >
<g:tab>
<g:header>Lines</g:header>
<g:Label>Select Line Data Here</g:Label>
</g:tab>
<g:tab>
<g:header>Features</g:header>
<g:Label>Select Features Data Here</g:Label>
</g:tab>
<g:tab>
<g:header>Help</g:header>
<g:Label>Help goes here</g:Label>
</g:tab>
</g:TabLayoutPanel>
<g:HorizontalPanel>
<g:Button>Generate KML</g:Button>
<g:Button>Generate Shapefile</g:Button>
</g:HorizontalPanel>
</g:VerticalPanel>
Centering an item can be done with a cell element like this:
<g:HorizontalPanel width="100%" height="100%">
<g:cell horizontalAlignment="ALIGN_CENTER" verticalAlignment="ALIGN_MIDDLE">
<g:Label>Hello Center</g:Label>
</g:cell>
</g:HorizontalPanel>
The problem here is, that .gwt-TabLayoutPanel will not be applied to your TabLayoutPanel. That's because the class names in GWT's UiBinder styles will be obfuscated in the resulting CSS.
There are basically two solutions:
a) Either put your CSS for .gwt-TabLayoutPanel in a plain CSS file. Include that file in your HTML page using
<head>
...
<link type="text/css" rel="stylesheet" href="My.css">
...
</head>
This way, the class name won't be obfuscated.
b) Or (probably better), in the UiBinder <style> section, use an an arbitrary class name like .panel, and change your code like this:
<ui:style>
.panel {
vertical-align: middle;
text-align: center;
margin-left: auto;
margin-right: auto;
border-top: 1px solid #666;
border-left: 1px solid #999;
border-right: 1px solid #666;
}
</ui:style>
...
<g:TabLayoutPanel barHeight="20" ui:field="interfaceTabs"
height="300px" width="80%"
addStyleNames="{style.panel}" >
This way, the class name will be obfuscated both in the style definition, and in the class attribute of your panel.
Now your panel should be centered.
There is another solution exactly for jour case (btw mentioned in javadoc as not recommended for new code).
In View:
interface GlobalResources extends ClientBundle {
#NotStrict
#Source("../resources/css/global.css") //legacy.css
CssResource css();
}
View's constructor:
// Inject global styles.
GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected();
That way standart CSS can be used without obfuscation.
global.css:
.gwt-DialogBox .Caption {
background: #E3E8F3;
padding: 4px 24px 4px 8px;
cursor: move;
border-bottom: 1px solid #BBB;
border-top: 0px solid white;
text-align: center;
font-family: Georgia, Times New Roman, sans-serif;
}
I injected GlobalResources in main presenter so editing theme for standart widgets (MenuItem,DialogBox,etc.) became much easier.
If the obfuscation of the stylename is the problem as the others suggested simply add:
#external .gwt-TabLayoutPanel;
to the <ui:style> part.