CSS3 Icon: inserted content isn't placed consistently - html

I'm creating icons using only CSS3. So far so good, but I've run into a problem with the simplest one.
I just want to have an "!" centered in a circle, but its position isn't consistent. Sometimes it's a pixel higher, a pixel to the left, or both.
I have no idea what's causing this.
Here's a fiddle.
.nos {
position: relative;
height: 12px; width: 12px;
border: 2px solid #e04006;
border-radius: 50%; -webkit-border-radius: 50%; -moz-border-radius: 50%;
display: block;
color: #e04006;
overflow: hidden;
cursor: default;
}
.nos:hover {
overflow: visible;
}
.nos span {
position: absolute;
padding-left: 18px;
display: block;
font-size: 14px; line-height: 16px; text-decoration: underline;
white-space: nowrap;
}
.nos:before {
content: '\21';
position: absolute; top: 0; bottom: 0; left: 0; right: 0;
margin: 0;
height: 16px; width: 16px;
display: block;
font-family: "Lucida Console", Monaco, monospace; text-align: center; font-size: 12px; line-height: 12px; font-weight: bold;
}

Remove the height: 16px; width: 16px; from .nos:before
Update Fiddle

Looks like I managed to fix it after some tinkering. Not sure what did the trick.
.nos {
position: relative;
width: 12px; height: 12px;
border: 2px solid #e04006;
-webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%;
display: inline-block;
color: #e04006;
overflow: hidden;
cursor: default;
}
.nos:hover {
overflow: visible;
}
.nos span {
position: absolute; top: -2px; left: -2px;
height: 16px;
padding-left: 18px;
display: block;
text-decoration: underline; font-size: 14px; line-height: 16px;
white-space: nowrap;
}
.nos:before {
content: '\21';
position: absolute; top: -2px; left: -2px;
width: 16px;
display: block;
font-family: Verdana, Geneva, sans-serif; text-align: center; font-weight: bold; font-size: 13px; line-height: 13px;
}
Fiddle

Related

why is the layout of my website different on mobile?

I'm trying to make a simple website for a homework.
This is how the site looks like on google chrome.
At first, I used px instead of '%' for my website, then changed it because turned out it looked different on different browsers. After I used '%', I was satisfied because it looked the same, but then I tried to open it on my phone's google chrome and this is how it looks
I tried using the meta viewport, but that only made it worse. All the element overlaps with each other. My friends didn't use any media queries and their sites still looked alright on both mobile and desktop (fonts looked smaller and everything, but the layout was still alright).
here's the css code:
<style>
.header{
background-image: url("https://www.blibli.com/friends/assets/masakan-indonesia-featured-696x464.jpg");
position: absolute;
height: 25%;
width: 99%;
text-align: center;
filter: blur(2px);
-webkit-filter: blur(2px);
}
.headertext{
font-family: Bebas Neue;
font-size: 4.5em;
top: 7%;
left: 28%;
position: absolute;
color: white;
z-index: 1;
text-decoration: none;
}
/* Add a black background color to the top navigation */
.topnav {
background-color: chocolate;
overflow: hidden;
position: absolute;
width: 99%;
top: 26.5%;
}
/* Style the links inside the navigation bar */
.topnav a {
float: left;
display: block;
color: white;
text-align: center;
padding: 1% 9.92%;
text-decoration: none;
font-size: 1.373em;
font-family: Roboto;
}
/* Change the color of links on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
/* Add an active class to highlight the current page */
.topnav a.active {
color: white;
}
/* Hide the link that should open and close the topnav on small screens */
.topnav .icon {
display: none;
}
.sidebar{
width: 20%;
height: 107%;
float: left;
display: block;
top: 40%;
position: absolute;
background-color: rgba(148, 145, 141, 0.37);
}
.main{
width: 76.3%;
height: 220%;
display: block;
position: absolute;
top: 40%;
left: 23%;
background-color: rgba(148, 145, 141, 0.37);
}
.box{
border:1px solid red;
position:absolute;
width:80%;
height:22%;
left: 5%;
transition: 0.2s;
}
.box:hover{
transform: scale(1.05);
}
.top{
top: 3%;
}
.middle{
position: absolute;
top: 31%;
}
.bottom{
position:absolute;
bottom:19%
}
.picture{
object-fit: cover;
width: 50%;
height: 85%;
position: absolute;
top: 7.5%;
left: 3%;
}
.text {
width: 40%;
height: 80%;
position: absolute;
top: 7.5%;
right: 4%;
font-family: Roboto;
font-size: 0.9em;
text-align: justify;
}
.judul{
font-family: Bebas Neue;
font-size: 1.6em;
line-height: 2;
letter-spacing: 0.3em;
}
.link{
bottom: 0px;
position: absolute;
font-family: Roboto;
font-size: 0.7em;
}
.button{
text-decoration: none;
display: inline-block;
padding: 1.5% 10%;
position: absolute;
bottom: 7%;
left: 35%;
font-family: Roboto;
font-size: 1.2em;
}
.button:hover{
background-color: white;
color: black;
}
.more{
background-color: chocolate;
color: white
}
.rekomendasi{
display: block;
position: absolute;
width: 96%;
height: 5%;
font-size: 1.8em;
font-family: Bebas Neue;
padding: 2%;
background-color: chocolate;
text-align: center;
letter-spacing: 0.1em;
color: white;
}
.rekomendasicontent{
position: absolute;
top: 85%;
font-size: 0.6em;
text-align: left;
font-family: Roboto;
letter-spacing: 0em;
color: black;
line-height: 160%;
}
.populer{
display: block;
position: relative;
top: 49%;
width: 96%;
height: 5%;
font-size: 1.8em;
font-family: Bebas Neue;
padding: 2%;
background-color: chocolate;
letter-spacing: 0.1em;
color: white;
text-align: center;
}
.populercontent{
font-size: 0.6em;
text-align: left;
font-family: Roboto;
letter-spacing: 0em;
position: absolute;
top:85%;
color: black;
line-height: 160%;
}
.link2{
color: black;
text-decoration: none;
background-color: none;
}
li{
transition: 0.2s;
}
li:hover{
transform: scale(1.1);
}
.footer{
width: 97.8%;
position: absolute;
top: 260%;
background-color: chocolate;
font-family: Roboto;
font-size: 1em;
color: white;
text-align: center;
padding: 0.5%;
}
</style>

Button is unclickable - possible causes?

I've made a button for my page, but it is not clickable. The pointer doesn't even appear. Why does it happen? How can I fix it?
Also, did I center the .intro and #more correctly? I feel like there is a better way than this which would also be more responsive, but I'm not sure. Some tips would be great!
Thanks a lot.
/*Continut centru*/
#continut {
padding-top: 250px;
font-family: 'Roboto Condensed', sans-serif;
width: 100%;
user-select: none;
pointer-events: none;
}
#intro {
text-transform: uppercase;
color: #77dff1;
font-size: 300px;
text-align: center;
}
.intro {
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
text-align: center;
display: table-cell;
vertical-align: middle;
max-width: 700px;
margin: 0 auto;
line-height: 30px;
}
/*Buton MORE*/
#more {
position: absolute;
top: 75%;
left: 50%;
transform: translate(-50%, -50%);
background-color: transparent;
border: #77dff1 2px solid;
text-align: center;
text-decoration: none;
padding: 15px;
display: inline-block;
font-size: 2rem;
color: #fff;
font-family: 'Roboto Condensed', sans-serif;
}
<div id="continut">
<h1 id="intro">hi</h1>
<h6 class="intro">asdf</h6>>
<button type="button" href="#" id="more">More...</button>
</div>
Your parent div #continut has pointer-events as none and that's the reason the default mouse-event of button to is none, to override you could you !important rules.
/*Continut centru*/
#continut {
padding-top: 250px;
font-family: 'Roboto Condensed', sans-serif;
width: 100%;
user-select: none;
pointer-events: none;
}
#intro {
text-transform: uppercase;
color: #77dff1;
font-size: 300px;
text-align: center;
}
.intro {
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
text-align: center;
display: table-cell;
vertical-align: middle;
max-width: 700px;
margin: 0 auto;
line-height: 30px;
}
/*Buton MORE*/
#more {
position: absolute;
top: 75%;
left: 50%;
transform: translate(-50%, -50%);
background-color: transparent;
border: #77dff1 2px solid;
text-align: center;
text-decoration: none;
padding: 15px;
display: inline-block;
font-size: 2rem;
color: #fff;
font-family: 'Roboto Condensed', sans-serif;
pointer-events: auto !important;
/* Add this */
}
<div id="continut">
<h1 id="intro">hi</h1>
<h6 class="intro">asdf</h6>
<button type="button" href="#" id="more">More...</button>
</div>
/*Continut centru*/
#continut {
padding-top: 250px;
font-family: 'Roboto Condensed', sans-serif;
width: 100%;
user-select: none;
}
#intro {
text-transform: uppercase;
color: #77dff1;
font-size: 300px;
text-align: center;
}
.intro {
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
text-align: center;
display: table-cell;
vertical-align: middle;
max-width: 700px;
margin: 0 auto;
line-height: 30px;
}
/*Buton MORE*/
#more {
position: absolute;
top: 75%;
left: 50%;
transform: translate(-50%, -50%);
background-color: transparent;
border: #77dff1 2px solid;
text-align: center;
text-decoration: none;
padding: 15px;
display: inline-block;
font-size: 2rem;
color: #fff;
font-family: 'Roboto Condensed', sans-serif;
z-index: 1;
cursor: pointer;
}
<div id="continut">
<h1 id="intro">hi</h1>
<h6 class="intro">asdf</h6>>
<button type="button" href="#" id="more">More...</button>
</div>

Div position pusing content

I am having trouble aligning my div so it doesn't push content below down, somehow if the asset name is more than one row, it will push down the metadata description down one row, I have tried positioning and flow and it seems now working, could some one please take a look to see what I have done wrong?
CSS
.port-container {
width: 490px;
height: 166px;
margin: 0px 0px 20px 0px;
float: left;
}
.port-container .port-image-link {
position: relative;
left: 10px;
}
.port-container .port-metadata-text {
padding: 50px 12px 10px 50px;
font-family: Arial, Helvetica, sans-serif;
color: #000;
font-size: 12px;
position: absolute;
margin-top: -180px;
margin-left: 173px;
z-index: 8;
line-height: 17px;
}
.port-container .port-image-link .port-text-link {
cursor: pointer;
width: 220px;
top: 138px;
position: relative;
text-decoration: none;
z-index: 9;
}
.port-container .port-image-link a {
text-decoration: none;
}
.port-container .port-image-link a span.port-text-link {
color: #fff;
font-family: Arial, Helvetica, sans-serif;
line-height: 17px;
position: relative;
top: -170px;
font-size: 12px;
text-decoration: none;
padding: 9px 50px 0px 0px;
font-weight: bold;
cursor: pointer;
left: 220px;
display: block;
}
.port-container .port-image-link a:hover span.port-text-link {
cursor: pointer;
text-decoration: underline;
}
HTML
<div class="port-container">
<div class="port-image-link">
%asset_thumbnail%<span class="port-text-link">%asset_name%</span>
<div class="port-metadata-text">%asset_metadata_DC.Description%</div>
</div>
</div>

Best technique to style badge

How you would style counter badge for example facebook notification? the value is not necessary one digit. It can be one or two. Also in my attempt I don't see how I can center the value.
#counter {
display: block;
width: 18px;
height: 18px;
padding: 2px;
position: absolute;
font-size: 12px;
left: 0;
top: 10px;
background: red;
border-radius: 3px;
text-align: center;
color: #fff;
}
<span id="counter">12</span>
Try to change the value to 1 digit, it doesn't look center again. It's slightly off.
#counter {
display: block;
padding: 2px 4px;
position: absolute;
font-size: 12px;
left: 0;
top: 10px;
background: red;
border-radius: 3px;
text-align: center;
color: #fff;
line-height:18px;
}
<span id="counter">111</span>
#counter {
display: block;
width: 18px;
height: 18px;
padding: 2px;
position: absolute;
font-size: 12px;
left: 0;
top: 10px;
background: red;
border-radius: 3px;
text-align: center;
color: #fff;
line-height:18px;
}
<span id="counter">1</span>

Overlapping Slider Image When Resizing Window

When resizing my window to check the responsiveness of a Wordpress site that I'm working on I noticed that when moving up to a larger window size, all of a sudden my slider in the header overlaps on top of the content below it. Once you resize the window to a smaller size it corrects itself. What's the deal?
Here's my code for the slider and the content below it:
#slideshow_cont { width: 646px; float: left; margin-right: 0px; margin-bottom: 10px; position: relative; }
#slideshow { width: 646px; min-height: 280px; }
.slide_box { display: none; position: absolute; top: 0; left: 0; }
.slide_box_first { display: block; width: 646px; height: 280px;}
.slide_box img { display: block; width: 646px; height: 280px; }
.slide_box iframe { display: block; width: 646px; height: 280px; }
.slide_box_title { padding: 8px 10px; font-size: 20px; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; text-transform: uppercase; background-color: #fff; height: 23px; }
.slide_box_title a { color: #222; text-decoration: none; }
.slide_prev { position: absolute; top: 132px; left: 0; cursor: pointer; z-index: 30; }
.slide_next { position: absolute; top: 132px; right: 0; cursor: pointer; z-index: 30; }
.home_box { float: left; width: 313px; background-color: #fff; margin-bottom: 0px; margin-right: 0px; }
.home_box img,
.home_box iframe { width: 313px; height: 196px; }
.home_box_last { margin-right: 0; }
.home_box_cont { padding: 5px 5px; text-align: center; }
.home_box_cont h3 { font-size: 20px; margin: 0px 0 10px; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; text-transform: uppercase; }
.home_box_cont h3 a { color: #222; text-decoration: none; }
.home_box_cont h3 a:hover { text-decoration: none; color: #f2664f; }
.home_box_text .home_box_cont { text-align: center; font-size: 18px; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; background-color: transparent;}
.archive_title { background-color: #F5F5F5; padding: 10px 8px; margin-bottom: 20px; font-size: 16px; }