Home > Back-end >  Is the following code valid according to the HTML standards?
Is the following code valid according to the HTML standards?

Time:05-01

I want the 1 question on the bottom left and 2 links on the bottom right place at the same level.

<p align="left"> Have a Question?
  <a href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&[email protected]"> Ask me</a>

  <a href="https://google.com/">
    <image tag>
  </a>

  <a href="https://google.com/">
    <image tag>
  </a>
</p>

This works fine for me but I'm not sure whether this is the correct way to do it or not.

CodePudding user response:

You can try something like this if you want the link to be left-aligned and the images to be right-aligned...

<div style="width: 90%;">

  <div style="float: left;">
Have a Question?<a href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&[email protected]"> Ask me</a>
  </div>

  <div style="float: right;">
    <img src="https://via.placeholder.com/150x20">
    <img src="https://via.placeholder.com/150x20">
  </div>

</div>

CodePudding user response:

After looking at your codepen. You need to add styles to them using CSS. I have added a flex display to <P> tag which basically aligns all elements inside <p> to same level and along row direction by default. Also, added a gap to add space between the child elements of

p {
  display: flex;
  gap: 10px;
}
<p align="left"> Have a Question?
  <a href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&[email protected]"> Ask me</a>

  <a href="https://google.com/">
    <image src="https://via.placeholder.com/150x20">
  </a>

  <a href="https://google.com/">
    <image src="https://via.placeholder.com/150x20">
  </a>
</p>

CodePudding user response:

align is not a valid HTML attribute, and <image tag> is not a valid HTML element

  •  Tags:  
  • html
  • Related