I am trying to draw a rectangle and I found the website for css code(http://css-tricks.com/examples/ShapesOfCSS/). How do I put together in HTML? In other words, how do I define #rectangle in HTML.
Facebook always has blue rectangle at the top of each page. What is the best way to achieve like them?
I appreciate if someone could help me.
. rectangle{ width:200px; height:300px; background-color:#000000; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); } This css code will definitely work for putting rectangle in the center.
Fiddle
HTML
<div id="rectangle"></div>
CSS
#rectangle{
width:200px;
height:100px;
background:blue;
}
I strongly suggest you read about CSS selectors and the basics of HTML.
Use <div id="rectangle" style="width:number px; height:number px; background-color:blue"></div>
This will create a blue rectangle.
Would recommend using svg for graphical elements. While using css to style your elements.
#box {
fill: orange;
stroke: black;
}
<svg>
<rect id="box" x="0" y="0" width="50" height="50"/>
</svg>
I do the following in my eBay listings:
<p style="border:solid thick darkblue; border-radius: 1em;
border-width:3px; padding-left:9px; padding-top:6px;
padding-bottom:6px; margin:2px; width:980px;">
This produces a box border with rounded corners.You can play with the variables.
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