Click here to Skip to main content
15,884,975 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: facebook and twitter share button plugins not working properly Pin
Member 1595298027-Apr-23 6:01
Member 1595298027-Apr-23 6:01 
QuestionI need ready-made web page codes in html and css / احتاج الى اكواد صفحه ويب جاهزة بلغة htmlو css Pin
Hussein Bajeham22-Mar-23 22:16
Hussein Bajeham22-Mar-23 22:16 
AnswerRe: I need ready-made web page codes in html and css / احتاج الى اكواد صفحه ويب جاهزة بلغة htmlو css Pin
OriginalGriff22-Mar-23 22:18
mveOriginalGriff22-Mar-23 22:18 
QuestionThree divs inside a div Pin
_Flaviu21-Mar-23 5:50
_Flaviu21-Mar-23 5:50 
AnswerRe: Three divs inside a div Pin
Jeremy Falcon21-Mar-23 11:39
professionalJeremy Falcon21-Mar-23 11:39 
GeneralRe: Three divs inside a div Pin
_Flaviu22-Mar-23 1:23
_Flaviu22-Mar-23 1:23 
GeneralRe: Three divs inside a div Pin
Jeremy Falcon22-Mar-23 5:02
professionalJeremy Falcon22-Mar-23 5:02 
GeneralRe: Three divs inside a div Pin
_Flaviu26-Mar-23 23:23
_Flaviu26-Mar-23 23:23 
GeneralRe: Three divs inside a div Pin
Jeremy Falcon27-Mar-23 4:32
professionalJeremy Falcon27-Mar-23 4:32 
AnswerRe: Three divs inside a div Pin
Jeremy Falcon21-Mar-23 11:40
professionalJeremy Falcon21-Mar-23 11:40 
QuestionWombat and Muppet know nothing about web push notifications... Pin
WhoPinchedMyName19-Mar-23 9:29
WhoPinchedMyName19-Mar-23 9:29 
AnswerRe: Wombat and Muppet know nothing about web push notifications... Pin
jschell21-Mar-23 5:58
jschell21-Mar-23 5:58 
GeneralRe: Wombat and Muppet know nothing about web push notifications... Pin
WhoPinchedMyName21-Mar-23 7:09
WhoPinchedMyName21-Mar-23 7:09 
GeneralRe: Wombat and Muppet know nothing about web push notifications... Pin
jschell23-Mar-23 5:47
jschell23-Mar-23 5:47 
GeneralRe: Wombat and Muppet know nothing about web push notifications... Pin
WhoPinchedMyName23-Mar-23 6:11
WhoPinchedMyName23-Mar-23 6:11 
GeneralRe: Wombat and Muppet know nothing about web push notifications... Pin
jschell24-Mar-23 12:05
jschell24-Mar-23 12:05 
QuestionCenter text vertically inside a div Pin
_Flaviu15-Mar-23 23:01
_Flaviu15-Mar-23 23:01 
AnswerRe: Center text vertically inside a div Pin
_Flaviu16-Mar-23 3:40
_Flaviu16-Mar-23 3:40 
GeneralRe: Center text vertically inside a div Pin
_Flaviu17-Mar-23 1:25
_Flaviu17-Mar-23 1:25 
AnswerRe: Center text vertically inside a div Pin
Richard MacCutchan17-Mar-23 1:47
mveRichard MacCutchan17-Mar-23 1:47 
GeneralRe: Center text vertically inside a div Pin
_Flaviu17-Mar-23 3:51
_Flaviu17-Mar-23 3:51 
GeneralRe: Center text vertically inside a div Pin
Richard MacCutchan17-Mar-23 4:20
mveRichard MacCutchan17-Mar-23 4:20 
GeneralRe: Center text vertically inside a div Pin
_Flaviu17-Mar-23 4:22
_Flaviu17-Mar-23 4:22 
GeneralRe: Center text vertically inside a div Pin
Richard MacCutchan17-Mar-23 4:30
mveRichard MacCutchan17-Mar-23 4:30 
AnswerRe: Center text vertically inside a div Pin
Jeremy Falcon20-Mar-23 8:43
professionalJeremy Falcon20-Mar-23 8:43 
Just a heads up, floats are not needed here at all. Anyway, the vertical align property is for inline containers. A div by default is a block level element so it's ignored. To see what I mean check out the examples on MDN and W3Schools.

With that being said, there are much, much better ways to do this. If you want to vertically center without having to use explicit heights, the recommended way these days is to just use flexbox. There are a ton of other techniques like negative margins, line height, etc. too but flexbox should be something to master anyway. So, no time like the present.
HTML
<div style="width:100%;height:100px;background-color:#aaddee;border-style:solid;border-width:1px;display:flex;align-items:center;justify-content:center;">
  <div style="background-color:#ffeaae;border-style:solid;border-width:3px;">
    Tuesday 2023-03-20
  </div>
</div>
Be aware that inline styles should be avoided. Only using them here to match your example.
Jeremy Falcon

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.