How is it possible that there is a 3 px difference in the vertical position of textfields in a form when seen in those 3 diff. browsers?
I am going insane. It is not good trying to fix it in the CSS because if I change it, it is fine in one but not in the others.
#pricefromR
{width:75px;
position:relative;
right:40px;
top: 50px;
}
#pricetoR
{width:75px;
position:relative;
right:-45px;
top: 24px;
}
So this corresponds to two texfields which are supposed to be paralell, at the same leve with each other, but they are not in different browsers, by a difference of 3 px and it happens the same with the other pairs which are each in a LI
<li>
<input type ="text" id = "areafromR" placeholder="area from" name = "areafrom" maxlength = "5">
<input type ="text" id = "areatoR" placeholder="area to" name = "areato" maxlength = "5">
</li>
All browsers are different, they have different defaults, and different wu=idths/heights. The best way that I know of is to either use percents, but that can get complicated. You can make a the CSS seperate for different browsers. For example ...... That is for internet explorer
You should try to reset your CSS
In case you didn’t know, every browser has its own default ‘user
agent’ stylesheet, that it uses to make unstyled websites appear more
legible. For example, most browsers by default make links blue and
visited links purple, give tables a certain amount of border and
padding, apply variable font-sizes to H1, H2, H3 etc. and a certain
amount of padding to almost everything. Ever wondered why Submit
buttons look different in every browser? It limits the difference
between browsers
Using a CSS Reset, you can force every browser to have all its styles reset to null, so less cross-browser differences
With this code:
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
A common practice is to put this in another CSS file.
Related
I have a very old working page which I don't want to change/upgrade at all. I need to add Bootstrap 3 because I've added a popup modal but Bootstrap default CSS reset/re-styling is changing the old page so it looks awful.
Is there any simple way to prevent Bootstrap CSS changing my page by default?
I know I can add a modal without bootstrap, but I've the bootstrap modal already written and working on another page of the same website so I would like to use the same code.
A great solution to prevent overwriting is to go to this page and select the components you just want to use. This will prevent you from bringing over unnecessary code you don't need and hopefully, it will prevent it from overwriting your css. Make sure you add all your css files after bootstrap is called. Also, you could add a css reset at the beginning of your css file. Then style accordingly and add important tags.
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
I'm using the tinymce wysiwyg for creating some nice looking instructions for my website.
I simply save the html generated code into my database, and display that html on a page.
Since my website has it's own stylesheets loaded, some things tend to show up according to what the styles dictate (like <ul>, <li>, or <p> tags)
If any of those tags are generated from tinymce, my site's stylesheets will style them.
Shot in the dark - Is there a style that makes a browser ignore all styles that reside inside a specific element?
For visual aid, here is a snapshot of the tinymce and what I'm making:
And here is a snapshot of the displayed html, on my site:
(this html resides inside <div id="tinymce_html"><?php echo $tinymce_html; ?></div>)
Here's the css that's affecting it (site-wide), inside the main.css stylesheet
ol, ul {
list-style:none;
padding: 0;
margin: 0;
}
Btw, I'm only giving an example of just the result for the <ul> tags. I'm sure I'll run into plenty more tags. (hence my original question - "is there a style that makes a browser ignore all styles that reside in a specific element?")
What I don't want to do is create an entirely new style sheet for anything related to tinymce, or other html I'd like to display without being affected by any site styles.
Use always a "reset css" before start new project!
Take a look at this.
Copy paste this style above your code and start from this. It reset all your elements.
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
Looks like you want to apply a css reset stylesheet.
Have a look here and take the one that seems the most applicable to you.
You will have to add this css to the editor using the custom_css tinymce config option.
So as most developers, i use a CSS RESET in all my work. One of the small problems i run into is that when developing custom anything in wordpress, i use this reset and the problem ive been having is that, because of said reset when the user is writing a post, the ability to for example, use italics / bold etc isnt available. I mean it is but its not applied because of said reset.
I just went in and removed the em / i / b etc tags from the reset block and its working BUT, theres one more thats giving me the biggest problem and thats that when someone hits the enter key to create space between text etc, nothing happens. they have to manually go in and put in <br/> tags to create the separation.
That said, it got me to thinking that....what exactly IS the css for line breaks/ the enter key?
below is whats in my CSS reset...not sure what else i have to remove.
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, img, ins, kbd, q, s, samp,
small, strike, sub, sup, tt, var, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0px;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
a{text-decoration:none;}
Ive tried to google but, aside from the p tag or the div tag etc...not sure what i have to remove to get the enter key/space created by pressing the enter key to go back to default.
Thanks in advanced.
To create separation such as a return, you can use a :after or :before like this:
p:after {
content: '\13';
display: block;
}
This will create a new line before of each paragraph element. You can use this trick with any kind of element.
Here's the fiddle:
http://jsfiddle.net/napy84/VQLTq/
I made a website that looks perfect on Internet Explorer, but when it is loaded with Firefox, certain elements are out of alignment.
For example, a p tag that would appear on the coordinates 20, 20, would appear in firefox on the coordinates 20, 40. For some reason, firefox changes the 'top' attribute of my p tags, such that they appear "lower" in firefox, than in ie. Please note that the 'left' attribute' remains unhindered, but the value for the 'top' (or y coordinate) is increased by about 20 pixels, everytime!
I would like to know why my P tags appear in their proper locations in Internet Explorer, but are lower in firefox?
Below is the code I used for each p tag. If you were to use this same code in a web page, you would see clearly that the p tag appears lower in firefox, than in i.e. everytime.
p.myparagraph
{position: absolute;
left: 20px;
top: 170px;
width: 20px;
height: 19px;
background-color:0033dd;
}
Why are my p tags appearing 30 pixels lower in firefox, than in Internet Explorer?
Each browser has its own CSS applied by default. To counter this, it is good practice to use some sort of CSS normalization (as pointed out by #You) before applying custom CSS. CSS normalization is recommended over an outright reset because it
Preserves useful defaults, unlike many CSS resets.
Normalizes styles for a wide range of elements.
Corrects bugs and common browser inconsistencies.
Source: Normalize.css
Also, do check out Initializr. It offers that plus a lot more, including IE6+ compatibility/fallbacks etc.
If not that, you could use a basic CSS reset,
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
Source: http://meyerweb.com/eric/tools/css/reset/
Try using a reset stylesheet then styling everything yourself.
My reset stylesheet styles a ton of tags (including P) with vertical-align: baseline;
That might help.
Flexible layouts use ems or % as font-size units a common practice is to use body font-size as 62.5%
But Firefox's default font is 14px which results in smaller layout than others who have 16px default font size
Can't we fix just body font-size to 10px so that relative sizes works in every browser.
Also, in addition to #Ray's answer..
For browser inconsitencies like these, consider using a reset stylesheet.
A good one can be found here. and here.
I am pasting the code here for sake of reference.
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
You are saying a lot of the right things here:
Ems and percents have traditionally been the units to use for "scalable" layouts.
The "cascade" in CSS includes the browser's own style sheet. So whenever you omit a style property for some element, it searches through the cascade and will pick up these missing properties from the browser's style sheet at the end of a chain.
If you want pixel-perfect font handling for page text that looks the same across browsers, you will need to define a font-size yourself. Using px on the body element should give you what you want. I'm not aware of any reason why this is still an issue. There was a time when some people would avoid px but modern browsers handle zooming nicely now that I suspect it is much less of an issue than it was.