I try to place “ABCD” at center of title but without success . Attached is a screenshot.
Can anyone tell me how to center a title within a centered div?
Thanks
I have formatted your code for you to make it easier for us to read. In the future, when you post code here you can format it yourself by placing three backticks(```) on the line before the code, and three backticks on the line after the code. Alternatively, you can highlight your pasted code and select the <> icon from the top of the edit area of your post.
I would like to recommend that you invest some time in yourself and take a basic HTML and CSS course. You will be impressed by how much you can learn to do in a reasonably short amount of time if you work all of the lessons and exercises.
Thanks a lot.
I haven’t yet given an insight look at the code you suggest but from first sight it lacks the vertical centering.
My code manages centering vertically but I couldn’t center it horizontally at the same time.
Thanks again !
I’m glad you found the link useful, but I confess I’m puzzled by your approach here. (Asking about centering in a div when you have no div does nothing to help the confusion. )
If it’s a title, wouldn’t an <h*> tag be more appropriate than a <p> tag? Why do you need the <span>? Why do you need to use absolute positioning? You may have good reasons for these that I’m unaware of, but you could achieve what you want more simply and with more semantic code.
I started with h2 but then couldnt attach it on top of page and it had wide spaces around it which I couldnt
understand the reason.
Then I thought I might have better control using div and span which I had.
Maybe I started with div then thought it to be unnecessary.
Yes, it brought much confusion upon me and unfortunatele it is shown at my posts…
Thanks again
I’m cordially thanking you Technobear.
My next step causes me the same nuisense. The block is spread all over. This time it is a form not title.
Why do the blocks in my html spread all over with so much wide spaces?!
Again, I’m not sure that you should be using HTML tables for this; it doesn’t look like tabular data to me. But leaving that aside, your problem is caused by using percentages for vertical margins.
IIRC (because I never use percentages for this ), the 10% is calculated as 10% of the width of the element. Use ems or even pixels to give the required margin. (And take the inline styles out of your HTML and put them in the CSS, where they belong.)
We don’t mind people asking beginner questions as long as you take the time to understand the basic fundamentals of html and css. Any beginners course will set you straight in a couple of hours and then you can progress to understand the layout subtleties of css in more depth without tripping on the same basic mistakes again and again.
As Technobear said above tables are really tabular data and that in most cases does not relate to form data (although some people still make a case for it). Anyway with the arrival of flexbox you don’t need such a complicated method to layout your forms anymore and it can be accomplished smoothly and effectively with flexbox.
Thank you,
The reason why I use table is that the page I’m working on is aimed to manage database:
Add, delete, edit, search.
This is true that I’m stuck on basic problems again and again because I dont do internet programming
on a daily basis. I randomly have needs where I’m working and then I try to do database work but I cannot
have an internet page without elementary design.
I once learnt css but since I do it once a year I tend to forget many things.
I’m not sure taking another course will be helpful because till next time I’ll forget.
Thank you so much again and my appology for annoying questions.