I have a shipping/billing input form and I'm having trouble styling the input fields to be the same width...
The Problem:
-a field <input type="text" size="X" /> appears to render with different sizes in different browsers (see link).
-In addition, select fields seem to render on a differently as well.
-Chrome/safari do not seem to respond to the font-size property for select fields.
Any guidance on how to stylize the size of text-input and select fields cross-browser would be oh so very helpful.
Must I result to having a different sytlesheet for each browser... just for these input fields?
-thanks
Remove that inline "size" attribute, first. You should use CSS to style the input form:
input[type="text"] {
width: 100px;
/* You can also style padding, margins and everything else,
* just remember that inputs of type "text" can only be one line.
*/
}
Don't use [type="text"] as a selector. I was just using it in this example to associate with input fields of type "text", but it's not fully cross-browser supported. You should give your text input fields their own class to stylize with.
Also, don't forget your CSS reset to make sure your margins, borders, et. al. are reset for all browsers. http://meyerweb.com/eric/tools/css/reset/
Nowadays, it's possible to normalize the width of "sized" inputs, using the ch unit, which has reached a decent browser support.
Unfortunately, it's still not possible to write:
input[size] {
width: attr(size) "ch";
}
So we have to style the widths we know we'll be using:
input[size="10"] {width: 10ch;}
input[size="20"] {width: 20ch;}
input[size="30"] {width: 30ch;}
/* etc. */
This can easily be automated using a CSS preprocessor.
UPDATE:
I made a test fiddle. As of today (feb. 2018), this is working on Windows 10 with Chrome 63, Edge 41, FF 58. On IE 11, it fails. I haven't tried on OS X.
Related
I am having issues to read the "value" propertie from a textarea element in a webpage.
The odd think is that the code use to work, but it stopped, apparently, after a chromedriver/chrome update.
The code line I am using to read it is:
Text = Selenium.FindElementByCss("textarea[id='some_textarea_id']").Value
But now it returns a empty string.
In the "console" tab of Chrome I can filter the text of the textarea element using the below css selector:
$$("textarea[id='some_textarea_id']")[0].value
But in Selenium VBA I fail when I try to use:
Text = Selenium.FindElementByCss("textarea[id='some_textarea_id']")[0].Value
or
Text = Selenium.FindElementByCss("textarea[id='some_textarea_id']")(0).Value
In the first case the sintax is not accepted. The line goes red and i can't run the program.
In the second case I get the error "the object does not accept this proporty or method".
The object is like these (also odd the text I am trying to read, does not appear here):
<textarea class="text sr " wrap="off" id="some_textarea_id" cols="20" maxlen="15" style="top: 0px; left: 103px; width: 132px; height: 21px; background-color: rgb(222, 224, 224);" arautocak="0" arautoctt="400" rows="1" readonly=""></textarea>
Does any one have any clue about the cause of this problem?
Problem solved. Turns out the problem was actually the chromedriver version.
I found out I was using the wrong version.
I don't know why, but there are apparently two chrome driver sites:
https://sites.google.com/a/chromium.org/chromedriver/downloads
and
https://chromedriver.chromium.org/home
In the site number 1 I only get version 91.0.4472.19 of chromedriver, that seems to have the bug I describe above.
In site number 2 I got version 91.0.4472.101 that didn't present that bug.
Note: My chrome browser version is: 91.0.4472.77.
I hope this information helps some one with the same problem. And if anyone knows why there are these two sites for chromedriver download I would love to know.
Thanks
I am using pdf.js. Fetching the Text I get blocks with font info
Object {
str: "blabla",
dir: "ltr",
width: 191.433141,
height: 12.546,
transform: Array[6],
fontName: "g_d0_f2"
}
Is it possible to get somehow more information about g_d0_f2.
Notice the PDF.js getTextContent will not and not suppose to match glyphs in PDFs. The PDF32000 specification has two different algorithms for text display and extraction. Even if you can lookup font data in the page.commonObjs, it might not be really helpful for extracted text content display due to glyphs encoding mismatch.
The page's getTextContent is doing text extraction and getOperatorList gets (glyph) display operators. See how src/display/svg.js renderer displays glyphs.
I'm building a site in Joomla 3 on T3 framework.
I'm having to use LESS for the first time, but am experienced with CSS.
The site will have differently themed landing pages. These will all be identical except for the colour scheme.
I am attempting to set up a colour scheme in the T3 'variables' less file and then implement the colours - the colour will be different for many core components - such as H1, P, DIV Background Color, etc.
So if I set up, say, a master colour for Thailand's page, I create this rule in the variables.less file:
#thai: #e55092;
and then my knowledge of exactly how LESS compiles to CSS falls flat and I lose my entire train of thought.
Because I now want to be able to set up a landing page for Thailand in the T3 template. I need to be able to use the class 'thai' in various places in this page - for instance, the H1 text should be coloured #e55092, an aside background should be #e55092, an HR should be #e55092 ... for THIS page only.
I hope this isn't a too open question but what would be best practice for achieving this, keeping my code clean and fast? My current line of thought is that I create a whole bunch of rules in LESS along the lines of:
thai.h1 { color: #thai }
thai.button [ background-color: #thai }
(excuse syntax - very new to LESS and not sure what's possible or correct)
But isn't that defeating the whole purpose of using LESS in the first place?
I think your question is very broad indeed. Depending on your situation:
One CSS file for all pages. You can consider changing selector order The code for a button can then look like that shown beneath:
.button {
border: 1px solid white;
.thai & { background-color: red;}
.japanese & { background-color: yellow;}
}
In your HTML pages: <body class="thai"> and so on..
Compile different CSS files for each landing page
In Less you can override a variable by putting the definition afterwards
You should first define a main file, for the button example this button.less file should contain something like that shown below:
#button-background-color: orange;
button { background-color: #button-background-color; }
Now you can define you thai theme file (thai.less) as follows:
#import "button.less";
#button-background-color: red;
Or alternatively compile different CSS files using the modify-var option:
lessc button.less --modify-var="button-background-color=red" thai.css
I use PhantomJS for PDF generation.
This is my command:
./phantomjs rasterize.js <someurl> test.pdf
It generates pdf file but:
The PDF looks nothing like the original website
I can't set the page orientation
Also is there any other options I can use for pdf generation?
The following change to rasterize.js also doesn't seem to work:
{ format: system.args[3], orientation: 'Letter', margin: '1cm' }
Rasterize.js is a very basic example of screen capture. There are some default values in this example that you can change to your needs.
page.viewportSize
Simulates the size of the window like in a traditional browser. In rasterize.js, it's { width: 600, height: 600 } ; not a common resolution and you may need to change this.
page.paperSize
Defines the size of the web page when rendered as a PDF. There are two modes : Manual (given a width and a height) or automatic (given a format). Do not hesitate to read the webpage documentation and the wiki page.
In your case, orientation: 'Letter' is invalid.
Supported formats are 'A3', 'A4', 'A5', 'Legal', 'Letter', 'Tabloid'.
Supported orientation are 'portrait' and 'landscape'.
Take a look at the source code and change it to your needs !
I am using an input tag to retrieve some user information. This user information is not required to be rendered by the browser so I have give it a class with 'display: none' applied.
IE6 and 7 are still rendering the space the input occupies but without rendering the content, the same way 'visibility: hidden' would work.
Are there any other ways to get IE6 and 7 to completely ignore the input?
If input hidden values are inside table then they are rendered without TR and TD; so adding them inside TR, TD and setting tr { display: none } has worked for me.
Have you tried giving the input type="hidden"?