I have a list of products, except the blue-colored one.
The blue is an information block from the company which is not related at all to the product listed.
So logically, to keep it semantic, I'm writing it like this.
<ul>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
</ul>
<div> <!-- the blue colored box here --> </div>
However with this arrangement, the blue-colored box will be displayed after the products, while the design requires me to put it between the products.
Is it possible to do this design semantically, without doing crazy stuff like using position: absolute
?
As per Html standards, we can not use div directly inside ul (unordered list) so we added 2 ul inside . navigation div. With the help of flex properties, display:flex; and justify-content:space-between; we have separated items in . navigation as per your requirement.
Grouping can be performed with the help of various tags such as <div>, <header>, <footer>, and <section>. HTML <div>: It is a block-level tag that groups various HTML tags into a single block.
You can force the content of the HTML <div> element stay on the same line by using a little CSS. Use the overflow property, as well as the white-space property set to “nowrap”.
So, in web design, a semantic element is an element that has intrinsic meaning, and conveys that meaning to both the browser and the developer. For example, <div> and <span> are non-semantic elements. They tell us nothing about their contents.
Yes its possible just add float: right
to div
and place div
before ul
in HTML
ul, li, body, html{
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
li {
width: 33.33%;
border: 1px solid black;
height: 100px;
float: left;
}
div {
width: 33.33%;
border: 1px solid black;
height: 100px;
background: blue;
float: right;
}
<div> <!-- the blue colored box here --> </div>
<ul>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
<li> <!-- product goes here --> </li>
</ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With