I just started learning html and css about 6 days ago. I do it for a hour a day and I'm having a lot of fun with it. I try to figure most of the issue I have on my own, but I've been having troubles finding resources to fix this problem.
#import url(http://fonts.googleapis.com/css?family=Merriweather);
*
{
text-decoration: none;
box-sizing: border-box;
}
body
{
background-color: #ff9900;
font-family: 'Merriweather', serif;
}
#page
{
margin: -8px;
}
#wrapper
{
/*margin: 1px;*/
}
h2>a
{
margin: -25px;
float: left;
background-color: #ffde00;
color: #097054;
padding: 20px;
}
h2>a:hover
{
color: #ffde00;
transition: .5s ease;
background-color: #6599ff;
}
.container
{
padding: 6px;
padding-right: 50px;
padding-left: 20px;
text-align: center;
background-color: #097054;
}
ul li
{
background-color: #ffde00;
display: inline;
margin: 0 auto;
padding: 10px;
color: #097054;
font-weight: 900;
font-size: 14pt;
}
ul li:hover
{
transition: .5s ease;
background-color: #097054;
border-color: #25C1BC;
color: #ffde00;
}
#p1
{
color: #097054;
height: 25em;
width: 25em;
background-color: #097054;
margin-left: 8px;
margin-top: 20px;
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 500ms;
}
p
{
background-color: #ffde00;
padding: 20px;
margin-top: 8px;
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 500ms;
}
#p1:hover;
{
/*background-color: #000000;*/
}
p:hover
{
height: -75%;
width: -75%;
padding-bottom: 3.8em;
box-shadow: -5px -5px 0px 0px #097054;
margin-top: 3em;
color: #ffde00;
background-color: #6599ff;
font-weight: 600;
}
Essentially what happens is that my navbar will become extremely disorganized after resizing. This causes links to overlap and look really awful.
Thank you for your time and consideration.
http://jsfiddle.net/JZ9LZ/
Add this .container{white-space: nowrap;}
This question has been asked before Disable line breaks using CSS
There's no way to solve your problem with only html/css as your li elements's width is minimum.
You should decrease the text font-size calculating it on the windows width, but this can be made only with javascript
My advice is to leave this page as before (as I imagine that is only for fun) and when you have good html/css skills you can start studying jQuery <- Very important for the UI
Related
I was wondering about why my code doesn't transition in and also out and I could not find answers.
I am sure there is some mistake comparing to other codes witch working effect but it's difficult to find for me. It's my first post tho so sorry for "stupid question"
h1 {
font-size: 40px;
text-align: center;
color: crimson;
margin: 0 10% 20px 10%;
padding-bottom: 15px;
border-bottom: 2px solid crimson;
}
h1:hover {
font-size: 45px;
transition: 0.3s;
}
<h1>Simple Text</h1>
I think you are trying to achieve something like this.
which is to apply that transition initially on h1 and not only in :hover.
h1 {
font-size: 40px;
text-align: center;
color: crimson;
margin: 0 10% 20px 10%;
padding-bottom: 15px;
border-bottom: 2px solid crimson;
transition: 0.3s;
}
h1:hover {
font-size: 45px;
}
<h1>Simple Text</h1>
It's all correct but you only need to put the transition in the h1 and not in the h1:hover.
So of you change it to this, it should work:
h1 {font-size: 40px;text-align: center;color: crimson;margin:0 10% 20px 10%;padding-bottom: 15px;border-bottom: 2px solid crimson; transition: 0.3s;}
h1:hover {font-size: 45px;}
I have a nav bar on the left corner of the page. the nav bar is already set on margin-left: -120px; on hover, it transforms to 105px, so I would like to have smooth back when un-hover the element.
I have tried to use transition on the ul, ul li, ul li a, putting them in different classes. nothing really working with me...
/* ----- NAVBAR ----- */
ul {
position: fixed;
z-index: 99;
}
.li1{
animation: move1 2s;
}
.li2{
animation: move1 3s;
}
.li3{
animation: move1 4s;
}
.li4{
animation: move1 5s;
}
.li5{
animation: move1 6s;
}
ul li {
text-align: center;
list-style: none;
padding-top: 10px;
margin-left: -120px;
}
ul li a {
text-align: center;
display: block;
text-decoration: none;
height: 30px;
line-height: 30px;
font-size: 12px;
font-weight: 400;
letter-spacing: 5px;
background: #1a2738;
width: 140px;
color: #fff;
text-transform: capitalize;
border-radius: 15px;
}
ul li a:hover {
background: #1a2738;
color: #fff;
animation: move2 1s forwards;
}
#keyframes move1 {
0% {
opacity: 0;
transform: translate(-50px);
}
40% {
opacity: 100;
transform: translate(105px);
}
}
#keyframes move2 {
100% {
transform: translate(105px);
}
}
I hope to know what's the actual problem, help please, thanks!
I think you are over complicating the CSS using keyframes you can use a transition instead see below code:
/* ----- NAVBAR ----- */
ul {
position: fixed;
z-index: 99;
}
ul li {
text-align: center;
list-style: none;
padding-top: 10px;
margin-left: -120px;
}
ul li a {
text-align: center;
display: block;
text-decoration: none;
height: 30px;
line-height: 30px;
font-size: 12px;
font-weight: 400;
letter-spacing: 5px;
background: #1a2738;
width: 140px;
color: #fff;
text-transform: capitalize;
border-radius: 15px;
transition: transform 1s ease-in-out;
transform: translateX(-50px);
}
ul li a:hover {
background: #1a2738;
color: #fff;
transform: translateX(105px);
}
If you are looking for a simple slide out and slide back in effect, one way to approach it is to simple use transform: transitionX(-120px) on your ul element, and just readjust the value from -120px to 0px on the hover of the ul, like so:
ul {
list-style-type: none;
padding: 1em;
background-color: #ececec;
color: #333;
display: inline-block;
transition: transform 600ms;
transform: translateX(-120px);
}
ul:hover {
transform: translateX(0px); //you can adjust this measurement unit to whatever value you wish, such as 105px
}
ul li {
text-align: center;
list-style: none;
padding-top: 10px;
}
ul li a {
text-align: center;
display: block;
text-decoration: none;
height: 30px;
line-height: 30px;
font-size: 12px;
font-weight: 400;
letter-spacing: 5px;
background: #1a2738;
width: 140px;
color: #fff;
text-transform: capitalize;
border-radius: 15px;
}
<ul>
<li>Home</li>
<li>About</li>
<li>contact</li>
</ul>
I am making a website: Website. In the menubar I have an underline when a specifi menu is active, or you hover over the menu options.
I would like that there is some px space from the menu text to the underline. How is that possible?
I tried to set a border-bottom:1px solid white, but that does not do the trick for me.
It is the following CSS the underline is on:
.wpmega-black-white .wpmm-mega-wrapper > li:hover,
.wpmega-black-white .wpmm-mega-wrapper > li.current-menu-item {
text-decoration: underline;
margin-top: 0.8em;
transition: all ease 0.3s;
-webkit-transition: all ease 0.3s;
-ms-transition: all ease 0.3s;
}
Edited
delete previous codes and modify your CSS as I wrote:
in your CSS files /css/style.css?ver=4.9.4 find and change these block of codes. please have a backup before modifinig
please note that you should not delete other parameters of elements, only change what I wrote.
.wp-megamenu-main-wrapper.wpmm-orientation-horizontal ul.wpmm-mega-wrapper > li > a {
padding: 20px 15px 10px 20px;
}
.wp-megamenu-main-wrapper.wpmm-orientation-horizontal ul.wpmm-mega-wrapper > li.current-menu-item a, .wp-megamenu-main-wrapper.wpmm-orientation-vertical ul.wpmm-mega-wrapper > li.current-menu-item a{
border-bottom: 2px solid #FFF;
}
.wp-megamenu-main-wrapper.wpmm-orientation-horizontal.wpmm-askins-wrapper ul.wpmm-mega-wrapper > li.menu-item-has-children > a:after {
top: 60%;
}
add this to your own css file
.wp-mega-menu-link:hover {
border-bottom: 2px solid #FFF;
}
text-decoration does exactly what is says it does, underline the text...you can't move the location of that underline (yet). You would have to use a positioned pseudo-element on the inner span.
For example:
ul {
list-style: none;
background: #000;
}
li {
display: inline-block;
}
li>a {
color: white;
padding: 20px 15px 20px 20px;
position: relative;
display: block;
font-size: 16px;
font-weight: 400;
font-style: normal;
line-height: 1.6;
overflow: visible;
font-family: "Work Sans", Helvetica, Arial, sans-serif;
text-transform: capitalize;
text-align: left;
text-decoration: none;
}
li>a span {
position: relative;
}
li>a span::after {
content: "";
position: absolute;
bottom: -10px;
/* adjust spacing here */
left: 0;
width: 0%;
height: 1px;
transition: width .3s ease;
background: transparent;
}
li>a.current-item span::after {
background: currentcolor;
width: 100%;
}
li>a:hover span::after {
width: 100%;
background: currentcolor;
}
<ul>
<li><span>MY TEXT HERE</span></li>
<li><span>MY NEW ITEM</span></li>
</ul>
This also means they can be animated.
How can I adjust the height of the Font Awesome social icons at the top right of this page so that they sit in the middle of the black bar and not at the bottom? Adding padding-bottom: to .social raises them but also increases the depth of the black bar which I don't want. Adding padding-bottom elsewhere has no effect. Thank you!!
.social {
padding: 0;
margin: 0;
font-size: 0;
height: 28px;
}
.image-caption .social {
height: 33px;
padding:top: 10px;
}
.social li {
display: inline-block;
margin-right: 15px;
margin-left: 15px;
}
.footer .widget.single .social li {
margin: 0 3px
}
.text-center .social li {
margin: 0 2px
}
.social li a {
display: table
}
.social li a i {
text-align: center;
padding-top: 7px;
display: table-cell;
vertical-align: middle;
color: #aaa;
background: none;
border: 1px solid #aaa;
width: 28px;
height: 28px !important;
line-height: 1;
font-size: 13px;
-webkit-transition: all 200ms ease-in;
-o-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
}
.social a:hover a:hover i {
background-color: #FFF
}
.social a:hover i {
color: #FFF
}
I am using a premium wordpress theme for a quick website I'm making. Almost everything can be set in the admin panel, which is great, but the header size is not one of them and I find it to be a bit large now. I'd like to use the 'custom css' section in the admin panel because I'm not interested in creating a whole child theme for just that one line of code.
I tried searching for the right class, something is making this thing so big, but what?
This is the url to the page I'm talking about;
http://lindenmobileappstore.nl/drsachs/
This is all the css regarding the header (that I could find at least);
/* 3.2. Header and subheader
==================================== */
#dp-head-wrap {background:transparent; position:relative;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
z-index:400;
}
.page-template-template-contact-php #dp-head-wrap.semi-transparent {
background-color: rgba(33, 51, 68, 0.9)!important;}
#dp-head {
position: relative;padding: 0 10px;
}
#dp-head:after {
clear: both;
content: "";
display: table;
}
#dp-head h1 {
float: left;
margin: 0;
}
#dp-head a.cssLogo {
background: transparent url('../images/logo.png') no-repeat 0 0;
display: block;
height: 42px;
width: 143px;
text-indent: -9999px;
margin: 30px 15px 10px 0;
background-size:cover;
}
#dp-head a.textLogo {
color: #5F8CB4;
display: block;
font-size: 18px;
line-height: 22px;
padding: 7px 0 0 10px;
}
#dp-head a.textLogo small {
color: #333;
display: block;
font-size: 12px;
line-height: 12px;
}
#dp-head a.imageLogo {
display: block;
width: 160px;
height:42px;
margin: 30px 15px 10px 0;
}
#dp-head a.imageLogo img {
display: block;
width: auto;
height: auto;
max-height: 100%;
height : 100%\9; /*hack: fixes ie8 logo*/
}
.dp-header-wrapper {
background-color: #232D37;
padding: 0;
color:#fff;
position:relative;
}
#dp-header {padding: 20px 0}
#dp-header .box {margin-bottom:0}
#dp-button-area {
float: right;
margin-left: 30px;
}
#dp-button-area a {
display: block;
float: right;
margin: 42px 0 0 0;
-webkit-transition: background-color .3s ease-out;
-moz-transition: background-color .3s ease-out;
-ms-transition: background-color .3s ease-out;
transition: background-color .3s ease-out;
width:25px;
height:25px;
text-align:center;
vertical-align:middle;
color: #2d3e52;
}
#dp-header-search, #dp-logout, #dp-login {
color: #2d3e52;
font-size:18px;
display:block;
line-height:18px;
}
#dp-header-search:hover, #dp-login:hover, #dp-logout:hover {color:#5F8CB4;}
#dp-header-search-form {width:100%;
height:100%;
position:absolute;
top:0;
display:none;
background:#ffffff;
z-index:1000;}
#dp-header-search-form .dp-page {padding:50px 10px 0 10px}
#dp-header-search-form #s {
width:95%;
border:none;line-height:36pxpx;
font-size: 36px;
height:50px!important;
font-weight: 300;
color: #b9bec3;
letter-spacing: 0px;
float:left;
padding:7px 0;
background:transparent;
}
#cancel-search {float:right; width:40px; height:40px;
cursor:pointer;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;color:#b9bec3 }
#cancel-search i {font-size:40px; text-align: center;line-height:40px;}
#cancel-search:hover {
transform:rotate(360deg);
-ms-transform:rotate(360deg);
-webkit-transform:rotate(360deg);
}
.dp-subheader-wraper {
background: #213344;
padding: 0;
}
.dp-subheader {position:relative; height:120px;}
.dp-subheader .main-title {margin:0; padding:25px 0 0 10px; font-size:36px;font-weight:100;line-height:40px}
.dp-subheader .sub-title {margin:0; padding:0 0 0 10px; font-size:13px; font-weight:400; opacity:0.7;}
.dp-subheader .dp-breadcrumbs {position:absolute;right:15px;top:45px;font-size:13px;}
.dp-subheader .dp-breadcrumbs a, .dp-subheader .dp-breadcrumbs span {opacity:0.7}
.dp-subheader .dp-breadcrumbs a:hover {opacity:1}
.sf-menu li {
height: 100px;
}
Remove menu item height and overall height will be based on logo image.