Help me position the object.
I need to place the object next to the <aside> but I can't get it to work. I'm working with the Django framework. The screenshot shows how I want it to be positioned. The second screenshot shows what I'm trying to achieve.
I will show the next HTML message.
main.css css is not a complete code
31 Replies
GitHub
contorl_project/website/users/templates/users/profile.html at featu...
Contribute to NIKITA-703/contorl_project development by creating an account on GitHub.
Have you tried giving that form a
margin-right: auto
? It needs to be in a container with display: flex
or display: grid
for it to workI tried using margin-left and it worked, but when I checked the result on another monitor (full HD), the elements were in different positions. I haven't tried using display: grid yet because I don't fully understand how to use it.
That's how responsive design works -- it'll look slightly different on every device and there's thousands+ of different device sizes
Alright it shouldn't look like that, you might have something hardcoded, as in some bad css practices
My recommendation: make a codepen and make a layout for this, and then bring it into Django / twig
Are you a backend dev or just learning?
learning
Stop using Django / twig for now, you're only overcomplicating it. Go back to the basics: learn html, css, then js and then you can go to Django
The thing is, I am writing a diploma using Django
You mean you're still in school and this is a school project?
college
That's unfortunate then because they haven't taught you how to use css ☹️ like my school too lol
I would look up some videos on Kevin Powell's youtube channel about flexbox and grid
But looking at this second image, you have it hardcoded:
margin-left: -1382px
. you pretty much never want to do thisI was just looking at what it looked like.
Yup just telling you that you should use flex or grid for this and not
position: absolute
with a magic number for your margin-left
Okay, I will keep that in mind. As I understand, I need to use grid to more accurately position the object.
I agree, you can get by with grids or flexbox + order
It's not about accuracy, it's about having your layout work on all devices
Now I need to figure out how to use grid
You're right
There is a cheat sheet on the grid
Make this red box as a
main
tag and put display: flex
on it, and then put margin-left: auto
on your formMDN Web Docs
Основные понятия Grid Layout - CSS: каскадные таблицы стилей | MDN
Грид-раскладка (CSS Grid Layout) представляет собой двумерную систему сеток в CSS. Гриды подойдут и для верстки основных областей страницы, и небольших элементов пользовательского интерфейса. Эта статья даёт общее представление о грид-раскладке и новой терминологии, которая является частью спецификации CSS Grid Layout Level 1. Более подробно пок...
Or here
https://tpverstak.ru/grid/
Анна Блок
Типичный верстальщик
Шпаргалка Grid CSS | Типичный верстальщик
Интерактивная шпаргалка по всем свойствам CSS Grid Layout для верстальщиков и фронтенд-разработчиков от Анны Блок.
I have this html structure. And class="background" can't cause a conflict? When I start changing something, it sometimes doesn't work because of the blur effect.
Yea that would cause a conflict because if your
main
container will be flex / grid, it'll treat the .background
as a child
You can put position: relative
on your main
and then position: absolute; inset: 0
on your .background
and that should fix it. But I'd consider making your .background
a background-image
on the main
tag insteadI did as you said. Now do I need to position the profile form to the left?
You should be able to do
margin-right: auto
*not margin-left: auto
(mistyped earlier)Okay, thanks for taking the time ❤, I'm starting to fall asleep tired today. I'll try to finish this