Margin propriety related with body tag - html

Could someone make me understand please, The effect of change values of margin's propriety is related with external element that has declared it's propriety.
Then by saying this, For me don't make sense we mess with it's propriety when we are talk about body tag since in practice we should see this change effect related with and tag

Related

User agent stylesheet is overriding my css even though it acknowledges it shouldn't?

I've scoured the internet (and Stack Overflow) searching for a solution to this simple problem, but to no avail.
The user agent stylesheet is telling me that it's being overridden by my styles, but is still applying it's own. Take a look:
Original code snippet:
Here, it shows clearly that the original display:block; is being overridden, as it should be.
,
Yet here, under the computed tab, it is still applying display:block. The container is set to display:table.
I isolated the effected elements in scratch html/css files, and there is no problems with overriding the user agent stylesheet there, as can be seen here:
.
What on earth could be causing this? Thanks in advance.
Also, !important doesn't work.
Edit: All of the screenshots decided to embed themselves overnight so it looked like a total mess, which is fun. Rather than delete this question out of embarrassment, I just cleaned that up real fast, although it's still pretty convoluted-looking but whatever.
Looking at your screenshot of the element's computed styles, I notice that its float is set to left. Floating an element tends to blockify it, and in the case of a table-row, that does indeed turn it into a block and ultimately detach it from its table container, as a table-row cannot normally be floated. This is not a case of the UA stylesheet overriding your styles, but how the display and float properties interact.
In order for a table layout to work you cannot float any of its internal table elements, including row groups, rows, and cells. (You can float the table itself.) As I am not familiar with your layout I won't be able to suggest a proper and complete answer to your question, but the key here is to remove the float declaration from that element. Since this declaration doesn't appear in your own styles it must be elsewhere — look for it among the rest of the element's styles. If necessary, override it using float: none.
(There may of course be other factors causing this blockification that as others have mentioned require a proper reproduction of your problem to diagnose, but this is what I could glean from just the screenshots you've provided and is a very common and likely cause.)

Getting rid of default html header styles?

I red somewhere that search engines like header tags to figure out the content or whatever. I'd like to use them but they just gunk up my style. I tried a style nullifier css file but since it addresses the text in question more precisely than my container class, it overrides the css defined there too. I guess I could just slap on !important to everything or create my own header styles but that would be messy since they aren't always supposed to look the same from page to page.
What would be the simplest way to completely erase any default styling on the header tags?
my html looks like this:
<div class="FancyBoxTitle">
<h1>fancy title goes here</h1>
</div>
use
h1,h2,h3,h4,h5,h6 {
margin:0;
padding:0;
}
EDIT: i saw someone above refering to css reset, others may refer to css normalize, BUT this two stylesheet have resets or "stylings" that might not apply to your case, thus its better to use specific "resets" than a whole bunch of useful and useless css rules that you may never need and just pile up as a big css rule bloat.

Is it mandatory to use position property while styling webpages?

While applying css I am getting the desired result without the use of the position property i.e:-
position:relative; or
position:absolute; etc...
But, I am a bit worried - is this the right way?
I mean, is applying position property for styling with css considered a good practice?
Thanks
Whether it is best to style the position property depends on your specific situation. If you have need to take elements out of the flow of the page, then you may want to use it.
But no, the position property is definitely not mandatory.
If you have styled your page without using position - and your satisfied that it is fully functional, there's nothing wrong with that.
Read about positioning to properly understand when to and why we change it from the default.
No. For the vast majority of things, position: static (the default) is fine.
Other positioning schemes should be used with a light touch. You can achieve some very powerful effects with them, but for most purposes such things are not needed, and used improperly they can create very fragile layouts.
Going by the CSS tutorial here:
http://www.w3schools.com/css/css_positioning.asp
They are good if you wish to affect the positioning of the image, for example if you need to move it slightly or position it next to another image.
more reading can be found here with examples:
http://quirksmode.org/css/css2/position.html
Personally I always position them, but I do not think it matters
Every element is static positioned by default
You cannot use z-index:property without the position property
You will not get the desired effect for z-index,if you are not specifying any of the position properties(relative,absolute,fixed)
left/right/top/bottom/z-index have no effect on a static positioned element.
NOTE:Just spend a few minutes here too position

Pesky lil' <small> element not working with text-align, needs to be blocked

So you've tried to center the <small> HTML element with the CSS property text-align: center (or right) and it doesn't work?
Well, that could be because your HTML/CSS looks something like this. There's an easy CSS solution...
If you set a small { display: block } property like this then it works like a charm:
Horay!
But you can probably tell something's not right... and why does it work anyway?
Well, <small> is basically an inline element and the text-align property is to be applied to block elements and passed down to child inline elements (or strings inside).
By making small into a block element we are allowing the text inside it to be styled.
Also, the W3 spec defines the <small> element to be used inside a phrasing context — similarly to elements like <strong>, <b>, <span>, <a>, and so on — which would do the same thing in this case.
W3 wiki examples suggest to put the <small> inside <p> tags and style that — I guess that's the more semantic solution, and here's the code if you need to see it.
Why is this a bit confusing?
Well, some 3rd party resources on the web don't mention it, or at least not explicitly. For example, the HTML5 Doctor's example uses the small element without a block element container around it.
Hope that clarifies things! As always, please let me know if I missed anything. (And I think I did.)

How do I learn what changes my css values?

I am a newbie (very much so), so my question might be dumb, but I couldn't find the answer.
For a contact table on a webpage I have set the height of 30px, but when I look at it in Google Developer tools, the height value is crossed out. I've tried to find out what causes my value to be overriden, but no luck. The developer tools shows that the value is overriden, but it doesn't show where.
So, the question is: How do I find what overrides my values in CSS?
In Chrome, your styles will inherit from any parent styles - either in the same style sheet or, if you have any, in other attached style sheets.
When a style inherits attributes either from parent elements or other classes, its predecessors will be listed in the Style Browser*, listed from nearest styles to most distant. So for example, if you have a paragraph that has a class assigned to it, but that paragraph is contained within a parent div that also has its own styles, your Style Browser will show the class name of that paragraph at the top (including all the class attributes), followed by the div's classes and so on up your DOM.
To discover which style is overriding your height value, scroll down through the Style Browser until you find a height attribute that isn't crossed out. You will also see the style sheet (including the line number) that contains the style that is affecting your page's appearance.
*You can open the style browser by right-clicking within a web page and selecting "Inspect Element".
You have to read the styles from the bottom going up.
You should find your CSS rule for the table in the styles section. Going up from that point you should be able to see which are the modifications that override your rule and display the element as depicted in the "Computed style" section.
If you dont find anything please give a look to your inline styles.
It would be easier to explain if I can look at some sample code...
The applied style is shown in the top and then the overridden ones are shown crossed out as you scroll down. So, the overridden value should be somewhere above the one which has been crossed out.