Toggle navigation
Email or Username
Password
Remember
Login
Register
|
I forgot my password
Questions
Unanswered
Tags
Users
Ask a Question
Layout. Margin-top nested divas. A strange bug?
0
like
0
dislike
15
views
Hello.
Faced with the problem
<div id="d1">
<div id="d2">
ee
</div>
</div>
#d2{ margin-top:10px; }
Reason is not shifted d2 inside of d1, and d1 pulls from the top to 10px
What's the problem?
html
asked
Mar 21, 2019
by
anonimizer_me
|
15
views
answer
comment
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
4
Answers
0
like
0
dislike
Margins shrink, this is normal. Solutions:
1)
#d2 {
margin-top: 10px;
display: inline-block; /* or inline, table, table-cell, etc */
}
2)
#d1 {
padding-top: 10px;
}
3)
#d2 {
margin-top: 10px;
position: absolute;
}
answered
Mar 23, 2019
by
anonimizer_me
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
www.complexspiral.com/publications/uncollapsing-margins/
it?
answered
Mar 23, 2019
by
ID175055
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
This is a true collapse fields in accordance with the standard. To get around this, you can, for example, at m2 instead of margin use padding from m1.
answered
Mar 23, 2019
by
CAH4A
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Thanks for the replies. Didn't know that some of the collapse.
answered
Mar 23, 2019
by
k12th
ask related question
comment
Please
log in
or
register
to add a comment.
Related questions
0
like
0
dislike
2
answers
Inside the body there is an element of. If you set margin-top in percent, as calculated these percentages?
asked
May 21, 2019
by
sorry_i_noob
css
html
layout
0
like
0
dislike
1
answer
Why inside the unit the top margin?
asked
May 21, 2019
by
emin313
css
html
0
like
0
dislike
2
answers
Why div with clear: both not respond to margin-top?
asked
May 20, 2019
by
toha_man
css
html
0
like
0
dislike
1
answer
In IE 11 does not work margin top, bottom flex-box?
asked
May 10, 2019
by
Senseich
css
html
layout
0
like
0
dislike
1
answer
Margin-top works incorrectly (HTML/CSS), what's the error?
asked
Apr 12, 2019
by
Lengdon
css
html
Most popular tags
javascript
php
css
html
jquery
wordpress
python
linux
web-development
mysql
android
windows
java
layout
c#
computer-networks
node.js
cpp
iron
yii
vue.js
1C-Bitrix
react
laravel
django
nginx
system-administration
search-engine-optimization
api
ubuntu
the-it-education.
ajax
sql
programming
hosting
cms
design
apache
google-chrome
bootstrap
Vkontakte
macos
google
network-administration
git
laptops
algorithms
regular-expressions
unity-game-engine
email
angular
database
network-equipment
software
wooŃommerce
debian
.net
ios
information-security
video
law-in-it
browsers
books
parsing
wi-fi
game-development
career
htaccess
postgresql
telegram
mikrotik
mobile-development
ruby-on-rails
the-domain-name-system
modx
Yandex
c
json
opencart
Habr
freelance
vpn
asp.net
windows-server
symfony
bots
hard-drives
math
qt
DIY
audio
frontend
payment-system
bash
electronics
gulp.js
user-interface
docker
online-shopping
110,608
questions
257,186
answers
0
comments
32,810
users