I am using React and try to build a website which allows you to analyze your twitter bubble. So, I have a form in which you can search for a twitter username. Thus, I put an "#" as a placeholder into this form, which disappears when you start typing. My goal is that the "#" stays when you start typing, so e.g. I could type "potus44" and it displays "#potus44" in this form (i hope this makes sense). So in the end, the "#" would not disappear but stay in front of the twitter handle.
See screenshot of my current form: Screenshot
This is the code for my form.
import React, { Component } from 'react';
import { FiTwitter } from "react-icons/fi";
const app = {
options: []
};
const onFormSubmit = (e) => {
e.preventDefault();
const option = e.target.elements.option.value;
if (option) {
app.options.push(option);
e.target.elements.option.value = '';
}
}
class Homepage extends Component {
render () {
return (
<div className="homepage">
<div className="container-pagecontent">
<main style={{marginTop: '150px'}}>
<h1 id="home" >Analyse your bubble! <FiTwitter size=".8em" /></h1>
<p>Search for your bubble.</p>
<form onSubmit={onFormSubmit}>
<input placeholder="#" className ="input" type="text" name="option"/>
<button className="button">Suchen</button>
</form>
</main>
</div>
</div>
)
}
}
export default Homepage
And this is my scss (in case it might be useful for you).
.button {
background-color: #1763A5;
font-family: bergen;
color: white;
border: 2px solid #1763A5;
padding: 6px;
font-size: 18px;
border-radius: 6px;
margin-left: 10px;
transition-duration: 0.4s;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
outline: none;
}
.button:hover {
background-color: white;
color: #1763A5;
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
.input {
width: 150px;
}
input[type=text] {
width: 170px;
padding: 7px 10px;
margin: 12px 0;
margin-right: 2px;
box-sizing: border-box;
border: 2px solid #1763A5;
border-radius: 6px;
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
outline: none;
}
and the code for the "container-pagecontent":
.container-pagecontent {
max-width: 95rem;
margin: 0 auto;
padding: 0 $m-size;
width: 100%;
text-align: center;
}
Thanks in advance for your help. Let me know if you need more insights into the project.
okay.
In styles.scss::
.homepage {
h1::before {
display: block;
content: " ";
margin-top: -150px;
height: 130px;
visibility: hidden;
pointer-events: none;
}
height: 110vh;
background-color: white;
padding-left: 40px;
padding-right: 40px;
}
#font-face {
src: url(/fonts/BergenText-Regular.otf);
font-family: bergen;
}
.button {
background-color: #1763A5;
font-family: bergen;
color: white;
border: 2px solid #1763A5;
padding: 6px;
font-size: 18px;
border-radius: 6px;
margin-left: 10px;
transition-duration: 0.4s;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
outline: none;
}
.button:hover {
background-color: white;
color: #1763A5;
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
.placeholder{
position: relative;
}
.placeholder::after{
content: attr(data-placeholder);
position: absolute;
left:0.325rem;
top:33%;
}
input[type=text] {
width: 170px;
padding: 7px 0 7px 20px;
margin: 12px 0;
margin-right: 2px;
box-sizing: border-box;
border: 2px solid #1763A5;
border-radius: 6px;
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
outline: none;
}
In App.js::
import React, { Component } from "react";
import "./styles.scss";
const app = {
options: []
};
const onFormSubmit = (e) => {
e.preventDefault();
const option = e.target.elements.option.value;
if (option) {
app.options.push(option);
e.target.elements.option.value = "";
}
};
class Homepage extends Component {
render() {
return (
<div className="homepage">
<div className="container-pagecontent">
<main style={{ marginTop: "150px" }}>
<h1 id="home">Analyse your bubble!</h1>
<p>Search for your bubble.</p>
<form onSubmit={onFormSubmit}>
<div className="placeholder" data-placeholder="#">
<input
className="input"
type="text"
name="option"
/>
</div>
<button className="button">Suchen</button>
</form>
</main>
</div>
</div>
);
}
}
export default Homepage;
There are two buttons in my sidebar. I want to make my button blue when it's clicked and to remain blue until the other button is clicked. It shouldn't change back to the old color when we click on the body or anywhere else but only when I click the other button.
It would also be nice if someone can show me if those sidebar buttons to turn white again when clicked on the create new button on the navbar.
code sandbox https://codesandbox.io/s/sweet-feynman-2tvy5
css for the buttons
.sideButton {
width: 200px;
height: 50px;
padding-left: 0px;
margin-left: 0px;
padding: 0;
border: none;
font: inherit;
color: inherit;
border-radius: 0 10px 10px 0;
background-color: rgba(191, 191, 191, 0.14);
box-shadow: inset 0 1px 10px 0 rgba(0, 0, 0, 0.15);
position: absolute;
left: 0;
right: 0;
cursor: pointer;
-webkit-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
-moz-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.1);
}
.sideButton:focus,
.sideButton:active,
.sideButton.active {
background-color: blue;
}
.sideButton2 {
width: 200px;
height: 50px;
padding-left: 0px;
margin-left: 0px;
margin-top: 55px;
padding: 0;
border: none;
font: inherit;
color: inherit;
border-radius: 0 10px 10px 0;
background-color: white;
box-shadow: inset 0 1px 10px 0 rgba(0, 0, 0, 0.15);
position: absolute;
left: 0;
right: 0;
cursor: pointer;
-webkit-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
-moz-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.1);
}
.sideButton2:focus,
.sideButton2:active,
.sideButton2.active {
background-color: blue;
}
the react files where the button is located
import React, { Component } from "react";
import { BrowserRouter as Router, Route, Switch, Link } from "react-router-dom";
import { Nav, Button } from "react-bootstrap";
import "../App.css";
export default class LeftBox extends Component {
constructor(props) {
super(props);
}
render() {
return (
<>
<div className="nav">
<ul>
<li className="list-item">
<Link to="/about">
<input
type="button"
className="sideButton sideBarText"
value="Dashboard"
/>
</Link>
</li>
<li className="list-item">
<Link to="/">
<input
type="button"
className="sideButton2 sideBarText2"
value="People"
/>
</Link>
</li>
</ul>
</div>
</>
);
}
}
You can create your own kind of link that would be in sync with url
import {
Link,
withRouter
} from "react-router-dom";
function NavInput({ value, className, to, location }) {
let isActive = to === location.pathname;
return (
<Link to={to}>
<input
type="button"
className={className + (isActive ? " active" : "")}
value={value}
/>
</Link>
);
}
const NavInputLink = withRouter(NavInput);
and then your leftBox.js would be
export default class LeftBox extends Component {
constructor(props) {
super(props);
}
render() {
return (
<>
<div className="nav">
<ul>
<li className="list-item">
<NavInputLink
to="/about"
value="Dashboard"
className="sideButton sideBarText"
/>
</li>
<li className="list-item">
<NavInputLink
to="/"
value="People"
className="sideButton2 sideBarText2"
/>
</li>
</ul>
</div>
</>
);
}
}
Please check https://codesandbox.io/s/cool-firefly-cq0hr
the easiest way to make this possible is using NavLink
leftBox.js
import React, { Component } from "react";
import {
BrowserRouter as Router,
Route,
Switch,
NavLink
} from "react-router-dom";
import { Nav, Button } from "react-bootstrap";
import "../App.css";
export default class LeftBox extends Component {
constructor(props) {
super(props);
this.state = {
button: false
};
}
render() {
return (
<>
<div className="nav">
<ul>
<li className="list-item">
<NavLink
to="/about"
className="sideButton"
activeClassName="active_navbar"
exact
>
Dashboard
</NavLink>
</li>
<li className="list-item">
<NavLink
to="/"
className="sideButton2"
activeClassName="active_navbar"
exact
>
People
</NavLink>
</li>
</ul>
</div>
</>
);
}
}
Change CSS
.sideButton {
width: 200px;
height: 50px;
padding-left: 0px;
margin-left: 0px;
padding: 0;
border: none;
font: inherit;
color: inherit;
border-radius: 0 10px 10px 0;
background-color: rgba(191, 191, 191, 0.14);
box-shadow: inset 0 1px 10px 0 rgba(0, 0, 0, 0.15);
position: absolute;
left: 0;
right: 0;
/* show a hand cursor on hover; some argue that we
should keep the default arrow cursor for buttons */
cursor: pointer;
-webkit-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
-moz-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.1);
}
.sideButton:focus,
.sideButton:active,
.sideButton.active {
/* background-color: rgba(191, 191, 191, 0.14); */
background-color: blue;
}
.sideButton:selected {
background-color: #007bff;
}
.sideButton2 {
width: 200px;
height: 50px;
padding-left: 0px;
margin-left: 0px;
margin-top: 55px;
padding: 0;
border: none;
font: inherit;
color: inherit;
border-radius: 0 10px 10px 0;
background-color: white;
box-shadow: inset 0 1px 10px 0 rgba(0, 0, 0, 0.15);
position: absolute;
left: 0;
right: 0;
cursor: pointer;
-webkit-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
-moz-box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.17);
box-shadow: inset 0px -1px 28px -1px rgba(0, 0, 0, 0.1);
}
.sideButton2:focus,
.sideButton2:active,
.sideButton2.active {
/* background-color: rgba(191, 191, 191, 0.14); */
background-color: blue;
}
.active_navbar {
background-color: blue;
}
.leftMain {
display: flex;
flex-direction: row;
padding-top: 40px;
}
.rightMain {
display: flex;
padding-top: 20px;
}
ul {
list-style: none;
}
.navbar {
position: fixed;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.7rem 2rem;
overflow: hidden;
z-index: 1;
width: 80%;
margin: auto;
top: 0;
border-bottom: solid 1px var(--primary-color);
opacity: 0.9;
position: relative;
top: 0;
/* box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.25); */
box-shadow: 12px 0 15px -4px rgba(31, 73, 125, 0.8),
-12px 0 8px -4px rgba(31, 73, 125, 0.8);
box-shadow: 0 9px 0px 0px white, 0 -9px 0px 0px white,
12px 0 15px -4px rgba(31, 73, 125, 0.8),
-12px 0 15px -4px rgba(31, 73, 125, 0.8);
}
.navbar ul {
display: flex;
}
.navbar a {
color: #2076d9;
padding: 0.45rem;
margin: 0 0.25rem;
}
.navbar a:hover {
color: var(--primary-color);
}
.navbar .welcome span {
margin-right: 0.6rem;
}
/* dashButton {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
dashButton::after {
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
opacity: 0;
transition: opacity 0.3s ease-in-out;
} */
#media (min-width: 768px) #dashboardpills .nav-item .nav-link {
max-height: 42px;
opacity: 0.25;
color: #000;
font-family: Poppins;
font-size: 30px;
font-weight: 700;
line-height: 42px;
}
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;
}
.nav-pills .nav-link {
border-radius: 0.25rem;
}
.nav-link {
display: block;
padding: 0.5rem 1rem;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
}
*,
::after,
::before {
box-sizing: border-box;
}
user agent stylesheet li {
text-align: -webkit-match-parent;
}
.nav {
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.titleName {
font-family: Poppins;
}
.sideBarText {
color: #000;
font-family: Poppins;
font-size: 18px;
font-weight: 600;
line-height: 25px;
}
.sideBarText2 {
color: #000;
font-family: Poppins;
font-size: 18px;
font-weight: 600;
line-height: 25px;
}
.createNew {
height: 40px;
width: 153px;
border: 0px;
border-radius: 10px;
/* background-color: #2076d9; */
background-image: linear-gradient(
to top,
#d83f91,
#d0409b,
#c743a5,
#bb47af,
#ae4bb8
);
box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.25);
}
.signOut {
border: 0px;
height: 40px;
width: 100px;
border-radius: 10px;
background-image: linear-gradient(
to right,
#eb3941,
#f15e64,
#e14e53,
#e2373f
);
box-shadow: 0 5px 15px rgba(242, 97, 103, 0.4);
box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.25);
}
.mainCom {
height: 56px;
width: 68px;
color: #000;
font-family: Poppins;
font-size: 40px;
font-weight: 700;
line-height: 56px;
left: 0;
cursor: pointer;
}
.mainComS {
height: 42px;
width: 255px;
opacity: 0.25;
color: #000;
font-family: Poppins;
font-size: 24px;
font-weight: 700;
line-height: 42px;
cursor: pointer;
}
.mainComS2 {
height: 42px;
width: 200px;
opacity: 0.25;
color: #000;
font-family: Poppins;
text-align: center;
font-size: 24px;
font-weight: 700;
line-height: 42px;
cursor: pointer;
}
.conMain {
height: 130vh;
margin-top: 20px;
width: 100%;
box-shadow: 12px 0 15px -4px rgba(31, 73, 125, 0.8),
-12px 0 8px -4px rgba(31, 73, 125, 0.8);
box-shadow: 0 9px 0px 0px white, 0 -9px 0px 0px white,
12px 0 15px -4px rgba(31, 73, 125, 0.8),
-12px 0 15px -4px rgba(31, 73, 125, 0.8);
}
ul {
list-style: none;
}
li:hover {
cursor: pointer;
}
You will get your all solution in it
You can change your class dynamically. Hitt the upvote if use like it.
$(document).ready(function(){
$("li").click(function() {
if($(this).siblings('li').find('input').hasClass('active')) {
$(this).siblings('li').find('input').removeClass('active');
$(this).find('input').addClass('active');
}
});
});
li {
list-style: none;
padding-right: 20px;
display: inline-block;
}
li .btn {
padding: 7px 20px;
background: #fff;
border: 1px solid #000;
font-size: 16px;
color: #000;
outline: none;
}
li .btn.active {
color: #fff;
background: #000;
border: 1px solid #000;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="wrap">
<ul>
<li>
<input class="btn active" type="button" name="Button 1" value="btn1">
</li>
<li>
<input class="btn" type="button" name="Button 3" value="btn2">
</li>
</ul>
</div>
Well, one of your ways to accomplish this, you can do is, make a state in your class, like:
state={mycolor:"red"};
And your button be like:
<button style={{color:this.state.mycolor}}
onClick={()=>this.colorhandler()}>click here</button>
And in your class define your colorhandler
colorhandler(){
this.setState({mycolor:"blue"});
}
And when you click on the button the color will change,
hope you get the idea and works for you
update
If you want keep your CSS files you can change code like this:
state={myclassname:"btn active"};
< button class={ this.state.myclassname}
onClick={ ()=>this.Classhandler()}> click here </ button>
Classhandler(){
this.setState({myclassname:"btn deactive"});
}
I have tried to add margin to my buttons but it makes the last button jump down a row. I think I know what is happening here but I'm not positive on how I should fix it. Here is what I have, what should I do?
.button {
width: calc(100% / 3);
height: max-content;
background: white;
-webkit-box-shadow: 0 8px 6px 10px black;
-moz-box-shadow: 0 8px 6px 10px black;
box-shadow: 0 8px 6px -1px grey;
margin: auto;
margin-top: 10px;
float: left;
margin: 0px;
font-family: sans-serif;
font-weight: 100;
text-align: center;
padding-top: 10px;
}
Page1
Page2
Page3
You can use a .button + .button rule to add a left margin when one button follows another. Like this, for example:
.button {
width: calc(80% / 3);
height: max-content;
background: white;
-webkit-box-shadow: 0 8px 6px 10px black;
-moz-box-shadow: 0 8px 6px 10px black;
box-shadow: 0 8px 6px -1px grey;
margin: auto;
margin-top: 10px;
float: left;
margin: 0px;
font-family: sans-serif;
font-weight: 100;
text-align: center;
padding-top: 10px;
}
.button + .button {
margin-left: calc(10%);
}
Page1
Page2
Page3
Here, the three buttons are allocated 80% of the parent containter's width, and the remaining 20% is shared equally between the second and third buttons.
a {
margin:12px;
}
Page1
Page2
Page3
I have div that have box-shadow on it and have also div:hover box-shadow.
When i check results at JSfiddle its all fine.
But when i check the results at my site i get the box-shadow right side removed:
Here is the Live code: JSfiddle
And here is the Code:
.nitz {
font-family: sans-serif;
font-size: 0;
width: 300px;
height: 76px;
direction: rtl;
background-color: #e4e5e8;
border-radius: 5px;
display: block;
box-shadow: inset rgba(255, 255, 255, 0.75) 0px 0px 0px 1000px,
inset rgba(255, 255, 255, 0.6) 0px 1px 0px,
inset rgba(255, 255, 255, 0.4) 0px 0px 0px 1px,
rgba(0, 0, 0, 0.2) 0px 1px 3px;
}
.nitz:hover {
-webkit-box-shadow: 0px 0px 5px 6px rgba(251, 219, 90, 1);
-moz-box-shadow: 0px 0px 5px 6px rgba(251, 219, 90, 1);
box-shadow: 0px 0px 5px 6px rgba(251, 219, 90, 1);
background-color: #f8f8f9;
box-sizing: border-box;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.boxtitle1 {
font-weight: bold;
text-align: right;
font-size: 14px;
padding-bottom: 3px;
}
.boxtitle2 {
text-align: right;
font-size: 14px;
}
.Cellbox2 {
display: inline-block;
margin-right: 15px;
margin-bottom: 15px;
vertical-align: top;
margin-top: 20px;
}
<a href="https://www.google.com" rel="">
<div class="nitz">
<div class="Cellbox2">
<div class="boxtitle1">That is a big test</div>
<div class="boxtitle2">That is a small one</div>
</div>
</div>
</a>
The over Divs are:
ipsWidget ipsWidget_vertical ipsBox
ipsWidget ipsWidget_vertical ipsBox
and
ipsList_reset
above all that divs.
The css of that divs are:
/* Blocks - styles for various widgets */
.ipsWidget {
position: relative;
padding: 0;
background: #fff;
}
.ipsWidget.ipsWidget_vertical {
margin-top: 15px;
}
.ipsWidget.ipsWidget_vertical .ipsWidget_title {
padding: 10px;
margin: 0;
font-size: 14px;
font-weight: 400;
position: relative;
color: #fff;
background: {theme="widget_title_bar"};
border-radius: 2px 2px 0px 0px;
}
.ipsWidget_inner{
padding: 10px;
}
.ipsWidget.ipsWidget_vertical .ipsWidget_inner {
color: #575757;
}
.ipsWidget.ipsWidget_horizontal {
padding: 0 0 10px 0;
}
.ipsWidget.ipsWidget_horizontal:not( .ipsWidgetHide ) + .ipsWidget {
margin-top: 10px;
}
.ipsWidget.ipsWidget_horizontal .ipsWidget_title {
font-weight: 400;
margin-bottom: 10px;
background: #f5f5f5;
padding: 10px;
}
.ipsWidget.ipsWidget_vertical .ipsWidget_inner {
color: #575757;
}
.ipsWidget.ipsWidget_horizontal .ipsTabs {
margin: -5px 0 5px 0;
}
.ipsWidget.ipsWidget_horizontal .ipsTabs_panel {
background: #fff;
margin: 0;
}
.ipsWidget_columns > [class*="ipsGrid"] {
margin-bottom: 0;
border-bottom: 0;
}
html[dir="ltr"] .ipsWidget_columns > [class*="ipsGrid"] {
border-right: 1px solid rgba(0,0,0,0.1);
padding-right: 10px;
}
html[dir="rtl"] .ipsWidget_columns > [class*="ipsGrid"] {
border-left: 1px solid rgba(0,0,0,0.1);
padding-left: 10px;
}
html[dir="ltr"] .ipsWidget_columns > [class*="ipsGrid"]:last-child {
border-right: 0;
}
html[dir="rtl"] .ipsWidget_columns > [class*="ipsGrid"]:last-child {
border-left: 0;
}
.ipsWidget_horizontal .ipsWidget_statsCount {
font-size: 22px;
line-height: 32px !important;
font-weight: 300;
}
.ipsWidget_horizontal .ipsWidget_stats {
margin-top: 15px;
}
.ipsWidget .ipsTabs_small {
padding: 0;
background: transparent;
}
.ipsWidget .ipsTabs_small .ipsTabs_item:not( .ipsTabs_activeItem ) {
color: rgba(50,50,50,0.6);
border-bottom: 1px solid transparent;
}
.ipsWidget .ipsTabs_small .ipsTabs_activeItem {
border-bottom: 1px solid rgba(0,0,0,0.25);
}
.ipsWidget .ipsDataItem_title {
font-size: 13px;
}
.ipsWidget.ipsWidget_primary {
background: #262e33;
}
.ipsWidget.ipsWidget_primary h3 {
color: #fff;
}
html[dir="ltr"] .ipsWidget_latestItem {
margin-left: 85px;
}
html[dir="rtl"] .ipsWidget_latestItem {
margin-right: 85px;
}
.ipsWidgetBlank {
margin-top: 16px;
padding-top: 30px;
}
I'm pretty sure the problem does not come from the code you linked.
Rather i guess that your button is on the border of a overflow : hidden div and the shadow falls outshide that div.
Or there is another invisible div beside the button hidding the shadow.
Look at that snippet and notice why part of the shadow doesn't show : The button is on the top right corner of the parent (".test") div.
I cannot check your code but i guess the problem comes from a parent div (maybe because you haven't fixed a width and it is stopping right after the button)
.test {
display: block
width: 400px;
height: 200px;
overflow: hidden;
}
.nitz {
font-family:sans-serif;
font-size: 0;
float: right;
width:300px;
height:76px;
direction:rtl; background-color:#e4e5e8;border-radius: 5px;
display:block;
box-shadow: inset rgba(255,255,255,0.75) 0px 0px 0px 1000px,
inset rgba(255,255,255,0.6) 0px 1px 0px,
inset rgba(255,255,255,0.4) 0px 0px 0px 1px, rgba(0,0,0,0.2) 0px 1px 3px;
}
.nitz:hover {-webkit-box-shadow: 0px 0px 5px 6px rgba(251,219,90,1);
-moz-box-shadow: 0px 0px 5px 6px rgba(251,219,90,1);
box-shadow: 0px 0px 5px 6px rgba(251,219,90,1);
background-color:#f8f8f9;
box-sizing: border-box;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.boxtitle1 {font-weight: bold;text-align:right; font-size:14px; padding-bottom:3px;}
.boxtitle2 {text-align:right; font-size:14px;}
.Cellbox1
{width:50px; height:50px; display:inline-block; margin-bottom:15px; margin-right:15px; margin-top:15px; }
.Cellbox2
{display:inline-block; margin-right:15px; margin-bottom:15px; vertical-align:top; margin-top:20px;}
<div class="test">
<a href="https://www.google.com" rel="">
<div class="nitz">
<div class="Cellbox2">
<div class="boxtitle1">That is a big test</div>
<div class="boxtitle2">That is a small one</div>
</div>
</div>
</a>
</div>
You can add some padding to the parent "anchor" tag with some classname
.some-class-name {
padding: 0 15px;
display: inline-block;
box-sizing: border-box;
}