Why is the two boxes to the right side, and not centered align?
fiddle: http://jsfiddle.net/gh76q/1/
I, tried change the position of box 2 to relative, it will do the trick but the box moves when hovering the box 1.
HTML:
<div align="center" id="top-link">
<div class="switch">
<div class="avg_display">Box 1</div>
<div class="avg_hide">Box1 info<br></div></div>
<div class="link-block">Box2</div>
</div>
CSS:
#top-link {padding-bottom:40px;}
.switch {display:inline-block;}
.link-block {
display: inline-block;
padding: 20px 20px 20px 20px;
border: 2px solid #e7e7e7;
border-radius: 5px;
height:25px;
width:200px;
text-align:center;
margin-top:10px;
margin-right:20px;
position:absolute;
color:#555;
}
.link-block a {
text-align: center;
vertical-align: middle;
line-height: 25px;
color:#555;
}
.link-block:hover {
background-color:#1396d0;
border:2px solid #1396d0;
color:#fff;
margin-top:10px;
margin-right:20px;
}
.link-block:hover a{
color:#fff;
}
.avg_display {
display:inline-block;
padding: 20px 20px 20px 20px;
border: 2px solid #e7e7e7;
border-radius: 5px;
height:25px;
width:200px;
text-align:center;
margin-top:10px;
margin-right:20px;
}
.avg_hide {
display:none;
padding: 20px 20px 20px 20px;
background-color:#1396d0;
border:2px solid #1396d0;
color:#fff;
border-radius: 5px;
height:250px;
width:200px;
text-align:center;
margin-top:10px;
margin-right:20px;
}
.avg_display a {
text-align: center;
vertical-align: middle;
line-height: 25px;
color:#555;
}
Fiddle:
Remove position:absolute from the box2 class.
.link-block {
display: inline-block;
padding: 20px 20px 20px 20px;
border: 2px solid #e7e7e7;
border-radius: 5px;
height:25px;
width:200px;
text-align:center;
margin-top:10px;
margin-right:20px;
/*position:absolute;*/
vertical-align:top; /* Keep the box always on top */
color:#555;
}
DEMO
Related
I am want to get the book repair button on left of the Svg button.
button{ float:right; background-color: #155FCC; padding: 10px 25px; color:white; border-radius:20px; box-shadow: none; border: none; } svg{ float: right; clear:right; height:55px; width:55px; }
This is the type of output that i am looking for.
Reverse the order of the elements in the HTML.
svg{ float: right; clear:right; height:55px; width:55px; }
button{ float:right; background-color: #155FCC; padding: 10px 25px; color:white; border-radius:20px; box-shadow: none; border: none; }
Hello i have created a website in 3 months using HTML, CSS, Jquery and PHP.
for design and layout i have used CSS, after building this website i have noticed that
Whenever i m opening my website in small screens so there is need of width scroll to see
whole page especially the language dropdown selection in right corner of page.
in my CSS i have used PX for divs such as wrapper, header and etc
Someone told me to use Percentage instead of PX, but i have reached to end.
First guys what i should do to solve this problem?
Second is there any way to convert from PX to Percentage.
.wrapper
{
width:1320px;
height:760px;
border:solid 1px #000;
margin:0 auto;
background:url(images/Background_Image.jpg) no-repeat;
}
.wrapper .logo
{
background:url(images/logo.png) no-repeat bottom;
width:360px;
height:180px;
margin-left:345px;
margin-top:10px;
float:left;
}
.wrapper .language
{
float:right;
background-color:#006;
padding:5px 10px;
border-radius:4px;
-webkit-border-radius:4px;
-moz-border-radius:4px;
-ms-border-radius:4px;
-o-border-radius:4px;
border:#00AEEF;
color: #FFFFFF;
font:bold 1.2em "Calibri";
margin:0px 0px 0px 0px;
cursor:pointer;
text-align:center;
}
.wrapper .language a
{
color:#FFF;
text-decoration:none;
font:"calibiri";
}
.wrapper .search_property
{
width:300px;
height:500px;
margin-right:58px;
margin-top:80px;
float:right;
}
.wrapper .search_property .title
{
background:url(images/protitle.fw.png) no-repeat;
width:295px;
height:80px;
margin-bottom:10px;
float:left;
text-align:center;
color:#FFF;
font: bold 1.7em "Calibri";
}
.wrapper .search_property .province
{
background:url(images/proprovince.fw.png) no-repeat;
width:295px;
height:70px;
float:left;
margin-bottom:10px;
text-align:center;
}
/* start design for the province */
select
{
width:195px;
margin-top:23px;
padding:3px 3px 3px 46px;
font: bold 1em "Calibri";
-webkit-border-radius:1px;
-moz-border-radius:1px;
border-radius:1.3px;
-webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
-moz-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
background: #f6f6f8;
color:#000;
border:none;
outline:none;
display: inline-block;
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
cursor:pointer;
}
option
{
text-align:center;
}
/* Targetting Webkit browsers only. FF will show the dropdown arrow with so much padding. */
#media screen and (-webkit-min-device-pixel-ratio:0) {
select {padding-right:18px}
}
.la
{
position:relative;
}
.la:after {
content:'<>';
font:11px "Consolas", monospace;
color:#000;
-webkit-transform:rotate(90deg);
-moz-transform:rotate(90deg);
-ms-transform:rotate(90deg);
transform:rotate(90deg);
right:8px; top:2px;
padding:0 0 2px;
border-bottom:1px solid #ddd;
position:absolute;
pointer-events:none;
}
.la:before {
content:'';
right:3.5px;
top:-1px;
width:25px; height:22px;
background:#ccc;
position:absolute;
pointer-events:none;
display:block;
}
/* end design for the province */
.wrapper .search_property .district
{
background:url(images/prodistrict.fw.png) no-repeat;
width:295px;
height:70px;
float:left;
margin-bottom:10px;
text-align:center;
}
.wrapper .search_property .propertystatus
{
background:url(images/prostatus.fw.png) no-repeat;
width:295px;
height:90px;
float:left;
margin-bottom:10px;
color:#FFF;
padding:20px 0 0 0;
}
radio
{
cursor:pointer;
}
.wrapper .search_property .probutton
{
width:270px;
height:50px;
float:left;
margin-bottom:3px;
padding:0 0 0 25px;
}
.wrapper .search_property .postprobutton
{
width:285px;
height:40px;
float:left;
margin-top:5px;
padding:0 0 0 10px;
}
#Submitbutton
{
background: #006 url(images/a.fw.png) no-repeat right;
padding:5px 15px;
border-radius:4px;
width:233px;
-webkit-border-radius:4px;
-moz-border-radius:4px;
-ms-border-radius:4px;
-o-border-radius:4px;
border:#00AEEF;
color: #FFFFFF;
font:bold 1.5em "Calibri";
margin:0px 0px 0px 0px;
cursor:pointer;
text-align:left;
}
#pypbutton
{
background: #006 url(images/Property%20List.png) no-repeat right;
padding:5px 15px;
border-radius:4px;
-webkit-border-radius:4px;
-moz-border-radius:4px;
-ms-border-radius:4px;
-o-border-radius:4px;
border:#00AEEF;
color: #FFFFFF;
font:bold 1.4em "Calibri";
margin:0px 0px 0px 0px;
cursor:pointer;
text-decoration:none;
}
.wrapper .slideshow
{
width:395px;
height:264px;
margin-left:325px;
margin-top:24px;
float:left;
}
.wrapper .menu
{
width:412px;
height:20px;
margin-left:327px;
margin-top:40px;
float:left;
}
.wrapper .menu .aboutus
{
width:68px;
height:18px;
color:#fff;
font: 1em Arial, Helvetica, sans-serif;
margin:0px 5px 0px 0px;
cursor:pointer;
float:left;
border-right:#039 solid 3px;
}
.wrapper .menu .myaccount
{
width:85px;
height:18px;
color:#fff;
margin:0px 5px 0px 0px;
font: 1em Arial, Helvetica, sans-serif;
cursor:pointer;
float:left;
border-right:#039 solid 3px;
}
.wrapper .menu .services
{
width:65px;
height:18px;
color:#fff;
font: 1em Arial, Helvetica, sans-serif;
margin:0px 5px 0px 0px;
cursor:pointer;
float:left;
border-right:#039 solid 3px;
}
.wrapper .menu .career
{
width:54px;
height:18px;
color:#fff;
font: 1em Arial, Helvetica, sans-serif;
margin:0px 5px 0px 0px;
cursor:pointer;
float:left;
border-right:#039 solid 3px;
}
.wrapper .menu .contactus
{
width:87px;
height:18px;
color:#fff;
font: 1em Arial, Helvetica, sans-serif;
margin:0px 5px 0px 0px;
cursor:pointer;
float:left;
}
.wrapper .footer
{
background:url(images/footerbg.jpg) bottom;
width:1120px;
height:155px;
margin-top:15px;
float:left;
margin-left:100px;
}
.wrapper .footer .footer_in
{
width: 900px;
height: auto;
margin: auto;
padding: 14px 0px 0px 0px;
}
.wrapper .footer .footer_in .footer_navigation
{
/*width:412px;*/
height:128px;
float:left;
font-size:11px;
background:url(images/border.jpg) right no-repeat;
font: 1em "Calibri";
width:350px;
}
.wrapper .footer .footer_in .footer_navigation .fn_heading
{
width:310px;
font: 1em "Calibri";
color:#fff;
height:37px;
font-size:12px;
background:url(images/footerimg.png) no-repeat;
padding-left:10px;
line-height:24px;
}
.wrapper .footer ..footer_in .footer_navigation ul {
float:left;
width:320px;
padding-left:9px;
}
.wrapper .footer .footer_in .footer_navigation li {
float:left;
width:127px;
background:url(images/listimg.gif) no-repeat left;
padding-left:12px;
display:block;
padding-bottom:4px;
}
.wrapper .footer .footer_in .footer_navigation li a
{
color:#fff;
text-decoration:none;
}
.wrapper .footer .footer_in .footer_navigation li a:hover {
text-decoration:underline;
}
.wrapper .footer .footer_in .copyright
{
background: url(images/border.gif) no-repeat scroll right center transparent;
color: #FFFFFF;
float: left;
font: 1em "Calibri";
min-height: 94px;
padding-left: 14px;
padding-right: 30px;
padding-top: 35px;
}
.wrapper .footer .footer_in .copyright a
{
padding-bottom:5px;
color:#fff;
text-decoration:none;
}
.wrapper .footer .footer_in .copyright a:hover
{
text-decoration:underline;
}
.wrapper .footer .footer_in .footer-add
{
text-align:center;
width:220px;
float:right;
margin-left:10px;
font: 1em "Calibri";
}
.wrapper .footer .footer_in .footer-add a
{
color:#fff;
background:url(images/link_for_scale-new_03.png) no-repeat bottom;
height:122px;
display:block;
}
Check your monitor resolution (By the CSS, my guess is that it is 1440x768).
Now do this math with every pixel value: ("Pixel Width Value"/1440)*100 and ("Pixel Height Value"/768)*100.
That is your value in %!
Some elements might not work properly, but it's a good way to start.
There are also other units that can work depending on the screen size
check one of them here.
However I think % might be the best for you to start out.
I am trying to make a basic button box with an arrow at the top of it...
http://jsfiddle.net/8K4qB/ --this is what it comes out to.. i can't make it align at the top in the middle of the bottom.
HTML Code
Read More
CSS Code
.button {
font-size: 15px;
color: white;
text-align: center;
padding:10px 30px 10px 30px;
margin:0 auto;
background: #2ecc71;
}
.test:before {
content:'';
position: absolute;
width: 0;
height: 0;
border-bottom: 20px solid #3498db;
border-right:50px solid transparent;
border-left:50px solid transparent;
}
I'd like it to look like the pic
In order to achieve the specific behaviour you're after you need to change your HTML as well as your CSS- otherwise centrally justifying a pseudo element correctly will elude you.. Change the elements in the example as required (e.g. the top level div can be changed to a.button.test)
REVISED FIDDLE
HTML
<div>
<div></div>
<div>text goes here</div>
</div>
CSS
div {
display:inline-block;
text-align:center;
}
div div:first-child {
display:block;
width: 0;
height: 0;
border-bottom: 10px solid darkorange;
border-right:30px solid transparent;
border-left:30px solid transparent;
margin: 0 auto;
}
div div:last-child{
display:block;
font-size: 15px;
color: white;
text-align: center;
padding:10px 30px 10px 30px;
margin:0 auto;
background: darkorange;
position:relative;
text-transform:uppercase;
}
Try this ,display:block so that your arrow still in the middle: DEMO
CSS:
.button {
font-size: 15px;
color: white;
text-align: center;
padding:10px 30px 10px 30px;
margin:0 auto;
background: #2ecc71;
display:block;position:relative;top:20px;
}
.test:before {
content:'';
position: absolute;
top:-20px;
width: 0;
height: 0;
border-bottom: 20px solid #3498db;
border-right:50px solid transparent;
border-left:50px solid transparent;
}
.middle{
padding-left:15px;
}
HTML:
<span class="middle">Read More</span>
I'm doing some HTML and am running into an issue with my left and right column divs not scaling based on the content inside them as well as in proportion to the rest of the page.
Here's my example:
http://i.imgur.com/9vi2EK9.png
And my CSS for each of the divs:
#wrapper{
background:white;
width:1280px;
position:relative;
border: 1px solid black; /* black border */
margin:auto; /* centre this div */
}
#header{
height:90px;
text-align:center;
padding: .5em;
background-color: grey;
border-bottom: 2px solid black;
}
#leftmenu{
width:100px;
float:left;
font-size: 75%;
padding:.5em;
border-right:2px solid black;
border-left:2px solid black,
}
#rightmenu{
width:180px;
float:right;
font-size: 75%;
padding:.5em;
border-left:2px solid black;
border-right:1px solid black;
}
#content{
background-color:white;
margin-left:120px;
font-size: 80%;
}
#footer{
clear:both; /* push footer under other divs */
height: 70px;
background-color:white;
border-top:1px solid black;
border: 1px solid black;
padding-top:40px;
text-align:center;
font-size: 70%;
}
How can I ensure that my divs resize based on the content in my other divs?
Thanks!
Without seeing your HTML, here's a stab at it:
JSFiddle here: http://jsfiddle.net/2hf8q/
CSS
html, body {
height: 100%;
}
#wrapper {
height: calc(100% - 2px); /* for border */
}
#leftmenu, #rightmenu {
height: calc(100% - 234px); /* for header, footer */
}
#wrapper {
background:white;
width:100%;
position:relative;
border: 1px solid black;
/* black border */
margin:auto;
/* centre this div */
}
#header {
height:90px;
text-align:center;
padding: .5em;
background-color: grey;
border-bottom: 2px solid black;
}
#leftmenu {
width:100px;
float:left;
font-size: 75%;
padding:.5em;
border-right:2px solid black;
border-left:2px solid black;
}
#rightmenu {
width:180px;
float:right;
font-size: 75%;
padding:.5em;
border-left:2px solid black;
border-right:1px solid black;
}
#content {
background-color:white;
margin-left:120px;
font-size: 80%;
}
#footer {
clear:both;
/* push footer under other divs */
height: 70px;
background-color:white;
border-top:1px solid black;
border: 1px solid black;
padding-top:40px;
text-align:center;
font-size: 70%;
}
HTML
<div id="wrapper">
<div id="header"></div>
<div id="leftmenu"></div>
<div id="content"></div>
<div id="rightmenu"></div>
<div id="footer"></div>
</div>
You can do it by wrapping #leftmenu, #content and #rightmenu in a div that is displayed as a table. And display the three children as a table-cell:
HTML:
<div id="header">#header</div>
<div id="wrapper">
<div id="leftmenu">#leftmenu</div>
<div id="content">#content</div>
<div id="rightmenu">#rightmenu</div>
</div>
<div id="footer">#footer</div>
CSS (without colors, padding, font sizes and stuff):
html, body {
margin: 0;
padding: 0;
}
#header{
height:90px;
}
#wrapper {
display: table;
table-layout: fixed;
width: 100%;
}
#wrapper > div {
display: table-cell;
}
#leftmenu{
width:100px;
}
#rightmenu{
width:180px;
}
#content{
}
#footer{
height: 70px;
}
And a working demo.
When I hover the first div for example, it is meant to change the bg color, and the color changes but it flashes when changing the color and it's not smooth at all in Chrome. but it is really smooth in IE and Firefox ... Why is that? (that's all I want to know)
CSS:
.bg {
position:absolute;
top:0;
left:0;
bottom:0;
right:0;
width:100%;
height:100%;
background-color:#D8D8D8;
z-index:-10;
}
.DIVOne {
color:#FFF;
margin-top:10%;
background-color:#A2D700;
height:300%;
line-height:200%;
width:20%;
padding:0 20px;
font-size:300%;
font-family:Verdana, Geneva, sans-serif;
margin-left:20%;
border: solid 5px #000;
border-width:0 4px 5px 0;
border-radius:5px;
border-color:transparent #ddd #999 transparent;
background-clip:padding-box;
text-align:center;
z-index:-5;
}
.DIVOne:hover {
border-width:0 2px 3px 0;
margin-right:4px;
position:relative;
left:2px;
top:3px;
}
.DIVOne:hover ~ .bg {
background-color:#A2D700;
transition:all 0.5s;
}
.DIVTwo {
color:#FFF;
background-color:#FF8000;
height:300%;
line-height:200%;
width:20%;
margin-top:10px;
padding:0 20px;
font-size:300%;
font-family:Verdana, Geneva, sans-serif;
margin-left:20%;
border: solid 5px #000;
border-width:0 4px 5px 0;
border-radius:5px;
border-color:transparent #ddd #999 transparent;
background-clip:padding-box;
text-align:center;
z-index:-6;
}
.DIVTwo:hover {
border-width:0 2px 3px 0;
margin-right:4px;
position:relative;
left:2px;
top:3px;
}
.DIVTwo:hover ~ .bg {
background-color:#FF8000;
}
.DIVThree {
color:#FFF;
background-color:#0080FF;
height:300%;
line-height:200%;
width:20%;
margin-top:10px;
padding:0 20px;
font-size:300%;
font-family:Verdana, Geneva, sans-serif;
margin-left:20%;
border: solid 5px #000;
border-width:0 4px 5px 0;
border-radius:5px;
border-color:transparent #ddd #999 transparent;
background-clip:padding-box;
text-align:center;
z-index:-6;
}
.DIVThree:hover {
border-width:0 2px 3px 0;
margin-right:4px;
position:relative;
left:2px;
top:3px;
}
.DIVThree:hover ~ .bg {
background-color:#0080FF;
}
HTML:
<div class="DIVOne"> Content </div>
<div class="DIVTwo"> Content </div>
<div class="DIVThree"> Content </div>
demo: http://www.jsfiddle.net/aryanf/w7unZ/
The problem is with the following code
.DIVOne:hover {
border-width:0 2px 3px 0;
margin-right:4px;
position:relative;
left:2px;
top:3px;
}
It's the position:relative; property that is causing the problem on Chrome. Try removing it. Besides, I don't see why you have introduced it in the first place. It seems to work fine without it.
.DIVOne:hover {
border-width:0 2px 3px 0;
margin-right:4px;
//position:relative;
left:2px;
top:3px;
}
If it is not rendering and appearing smooth on other browsers, try to add some css code additionaly inside your CSS file.
Suppose if you need Rounded Corner Border in IE, you will use
.ddlStyle {
border-radius: 4px;
height: 22px;
width: auto;
max-width: 300px;
min-width: 120px;
padding: 0 0 0px 0px;
padding-right: 4px;
font-family: Calibri,Verdana, Tahoma, 'Segoe UI';
}
But this may not render perfect on all other Browser due to different behavior of Rendering Engine. So make addition of some lines and try on other browsers.
.ddlStyle {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
height: 22px;
width: auto;
max-width: 300px;
min-width: 120px;
padding: 0 0 0px 0px;
padding-right: 4px;
font-family: Calibri,Verdana, Tahoma, 'Segoe UI';
}
Hope, it solves the problem.