CSS: center element within a element

Set text-align:center; to the parent div, and margin:auto; to the child div. #parent { text-align:center; background-color:blue; height:400px; width:600px; } .block { height:100px; width:200px; text-align:left; } .center { margin:auto; background-color:green; } .left { margin:auto auto auto 0; background-color:red; } .right { margin:auto 0 auto auto; background-color:yellow; } <div id=”parent”> <div id=”child1″ class=”block center”> a block to … Read more

Position last flex item at the end of container

Flexible Box Layout Module – 8.1. Aligning with auto margins Auto margins on flex items have an effect very similar to auto margins in block flow: During calculations of flex bases and flexible lengths, auto margins are treated as 0. Prior to alignment via justify-content and align-self, any positive free space is distributed to auto … Read more

How to stretch children to fill cross-axis?

The children of a row-flexbox container automatically fill the container’s vertical space. Specify flex: 1; for a child if you want it to fill the remaining horizontal space: .wrapper { display: flex; flex-direction: row; align-items: stretch; width: 100%; height: 5em; background: #ccc; } .wrapper>.left { background: #fcc; } .wrapper>.right { background: #ccf; flex: 1; } … Read more

CSS: Set a background color which is 50% of the width of the window

Older Browser Support If older browser support is a must, so you can’t go with multiple backgrounds or gradients, you’re probably going to want to do something like this on a spare div element: #background { position: fixed; top: 0; left: 0; width: 50%; height: 100%; background-color: pink; } Example: http://jsfiddle.net/PLfLW/1704/ The solution uses an … Read more

Responsive css background images

If you want the same image to scale based on the size of the browser window: background-image:url(‘../images/bg.png’); background-repeat:no-repeat; background-size:contain; background-position:center; Do not set width, height, or margins. EDIT: The previous line about not setting width, height or margin refers to OP’s original question about scaling with the window size. In other use cases, you may … Read more

How to target only IE (any version) within a stylesheet? [duplicate]

Internet Explorer 9 and lower : You could use conditional comments to load an IE-specific stylesheet for any version (or combination of versions) that you wanted to specifically target.like below using external stylesheet. <!–[if IE]> <link rel=”stylesheet” type=”text/css” href=”https://stackoverflow.com/questions/28417056/all-ie-only.css” /> <![endif]–> However, beginning in version 10, conditional comments are no longer supported in IE. Internet … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)