How do i create a header box in a bigger box? - html

I am trying to create a header box in a bigger box like the one in the image but only have an image to go on.
Any code snippets would be appreciated.

.parent {
border: 1px solid #ddd;
background: #fff;
}
.heading {
padding: 10px;
background-color: #0A7CDD;
color: #fff;
margin-top: 0;
}
p {
color: #333;
font-size: 16px;
padding: 0 10px;
}
<div class="parent">
<h3 class="heading">Other terms</h3>
<p>your text1 will go here,put all the text here.</p>
<p>your text2 will go here,put all the text here.</p>
</div>
Although This is wrong way to ask question, You have to try something yourself, but I was just free so here it is for you.

I offer this help because it looks like you are struggling to get started but you really should take note and analyse the code below and try to understand what each element is doing.
Remember StackOverflow is not a coding service and you will struggle to get help if you don't have a basic knowledge of what you are trying to achieve.
.Box {
display: flex;
flex-direction: column;
}
.Head {
background: #0a7cdd;
color: #fff;
padding: 10px;
}
.Body {
border: 1px solid #ddd;
padding: 10px;
}
<div class="Box">
<div class="Head">
<h2>Other Terms</h2>
</div>
<div class="Body">
<p>My credits must remain intact at the bottom of the auction template.</p>
<p>Please email me with any questions or if you need help with template installation.</p>
</div>
</div>
Key html elements you should look at are:
div
h2
p
Here is a good place to start:
https://www.w3schools.com/tags/tag_div.asp

Not an 100% solution to your "problem", where you straigt up get the solution to your problem, but more of a tip on how you can help yourself solve it.
What I tend to do when translating visuals into code is to "think out loud" what I see and try and transcribe it as well as I can into code. In your case you clearly see a blue header-section and below it a text-section. They are both wrapped inside a box with a border.
By defining these different parts it is fairly easy to get an idea as of how to structure it in code:
<div class="box">
<div class="header-section">
<h1> Header Text </h1>
</div>
<div class="text-section">
<p> Heres some text </p>
</div>
</div>
And then you go ahead and style it as you like.

Related

How to use the div tag in HTML

I am new to HTML and I was wondering how to use div tag, because every time I use it it doesn't do anything. What does it do and how do I use it?
The div tag works as a block element, meaning it allows you to insert into it content and other elements. It is a basic building block of any HTML page. Below is a simple example and you can follow this link to the official documentation for further insight.
.title {
background-color: gray;
font-weight: bold;
}
.body {
background-color: black;
color: white;
}
.something {
color: black;
background-color: white;
}
<div class="title">
Hello world! I can be the title of your web page
</div>
<div class="body">
<div>I can be the main body of your web page</div>
<div class="something"> with lots of other div elements comprising</div>
<div> the look and feel of the web page.</div>
</div>

My title isn't in the center

I am completely positive that my code causes my title to be in the center of my textbox, however, it doesn't look like it is! Can someone check that my code is sound?
.container {
width: 95%;
margin: 0 auto;
}
.home-about-textbox {
background-color: #232323;
padding: 4em;
width: 100vw;
margin-left: -2.65%;
outline: 2px solid #00ff6c;
outline-offset: -2.5em;
color: #FFF;
}
.home-about-textbox h1 {
text-align: center;
color: #00ff6c;
}
<div class="container">
<section class="home-about">
<div class="home-about-textbox">
<h1>Who I am</h1>
<p>I'm a young website developer who focusses on primarily making websites that are proven to have a <strong>high conversion rate</strong> so that my clients can experience that feeling of <strong>ever increasing cash flow!</strong></p>
<p>I usually like to spend a lot of my freetime working on either: a client's website design, or my personal website design. I am never the 'second-best' when it comes to website design which is why I offer numerous <strong>free</strong> design revisions
upon submission!</p>
</div>
</section>
</div>
Image of the Textbox:
Removing width: 100vwfrom .home-about-textbox seems fixed problem, no?
.container {
width: 95%;
margin: 0 auto;
}
.home-about-textbox {
background-color: #232323;
padding: 4em;
margin-left: -2.65%;
outline: 2px solid #00ff6c;
outline-offset: -2.5em;
color: #FFF;
}
.home-about-textbox h1 {
text-align: center;
color: #00ff6c;
}
<div class="container">
<section class="home-about">
<div class="home-about-textbox">
<h1>Who I am</h1>
<p>I'm a young website developer who focusses on primarily making websites that are proven to have a <strong>high conversion rate</strong> so that my clients can experience that feeling of <strong>ever increasing cash flow!</strong></p>
<p>I usually like to spend a lot of my freetime working on either: a client's website design, or my personal website design. I am never the 'second-best' when it comes to website design which is why I offer numerous <strong>free</strong> design revisions
upon submission!</p>
</div>
</section>
</div>
Why not write the <p> or <div> inside a <center> tag. It causes anything to be centered. In order to avoid further problems isolote the element to be centered from other elements.

how to make border-right's height according to vertical-middle

i'm an Asian person. I'm sorry because i'm not good at English writing and grammar.
I am designing a bulletin board's view page using HTML, JSP, CSS, and I'm implementing it using tag.
I want to implement distinguished right line between and tag, a written information such as writer, viewed number, title, etc,. like bottom image.the line looks like applied vertical-middle line of height value.
I want to implement this using CSS Attribute related border-right.
How can I design this using CSS ? pls T.T;;
please refer to the bottom exam's image that i want to make.
Regards,
You can do this by applying css
border property like -
border-right: thick groove black;
Or
You can apply sign convention like | between content.
I hope my answer may help you.
if it does, please upgrade me.
Please see if this is what you need
.overview { border-top: medium solid darkgray; }
.row {
width: 100%;
padding: 0.2em 0;
border-bottom: thin solid darkgray;
}
span {
display: inline-block;
min-width: 6em;
padding: 0 1em;
}
.h6 {
font-weight: 600;
text-align: center;
}
.b-r {
border-right: thin solid darkgray;
}
<div class="overview">
<div class="row">
<span class="h6 b-r">title</span>
<span>today's calendar</span>
</div>
<div class="row">
<span class="h6 b-r">writer</span>
<span class="b-r">administrator</span>
<span class="h6 b-r">date</span>
<span class="b-r">2017-06-15</span>
</div>
<div class="row">
<span class="h6 b-r">appended file</span>
<span>TimeTable.pdf</span>
</div>
</div>

Trying to move a button further down the page

I am fairly new to web development so I apologize if this is a "newbie" question, I've looked on various sites and tried various things but am not able to move a button on my page to where I want it to go.
Here's the code I have for it in HTML:
<div class="crown">
<div class="container">
<img src="http://www.clker.com/cliparts/3/8/d/6/12205466202120645650portablejim_Chess_tile_-_King_1.svg.med.png" height="250" width="200">
<h3><strong>Join today!</strong></h3>
<p style="text-align: center;"><a class="btn-two" href="#">Register</a></p>
</div>
</div>
<section class="footer">
<div class="container">
<p>© 2016</p>
</div>
</div>
</body>
</html>
And here's the CSS for it:
.btn-two {
border: 1px solid black;
padding: 20px;
text-decoration: none;
background-color: black;
color: white;
text-align: center;
margin: 20px 0 -30px 0;}
I've tried a lot of things in the CSS that aren't working. I want the button to be a few inches below the "Join today!" text but it stays where it's at, like a hair below the text when I want there to be space in between the text and the button. Any idea what I'm doing wrong? And again I'm new to all this so I appreciate your understanding. Thank you.
You have to add display:inline-block; or block to the .btn-two since anchor elements are display:inline by default and margin/padding can't affect em
Check the snippet below
.btn-two {
border: 1px solid black;
padding: 20px;
text-decoration: none;
background-color: black;
color: white;
text-align: center;
margin: 60px 0 0 0;
display: inline-block;
}
I am fairly new to web development so I apologize if this is a "newbie" question, I've looked on various sites and tried various things but am not able to move a button on my page to where I want it to go. Here's the code I have for it in HTML:
<div class="crown">
<div class="container">
<img src="http://www.clker.com/cliparts/3/8/d/6/12205466202120645650portablejim_Chess_tile_-_King_1.svg.med.png" height="250" width="200">
<h3><strong>Join today!</strong></h3>
<p style="text-align: center;"><a class="btn-two" href="#">Register</a>
</p>
</div>
</div>
<section class="footer">
<div class="container">
<p>© 2016</p>
</div>
</div>
You can also remove text-align:center; style from the <p> that contains the button.
Working fiddle: https://jsfiddle.net/L210zqvf/
Apply display: inline-block; to your .btn-two. An <a> tag is an inline element, generally not accepting width, height, margins etc. as long you don't do the above.
Yeah, and if you don't want it to be centered, remove style="text-align: center;" from your <p> Tag.
Anchor a elements are display:inline by default in a browser. Inline level elements can't have margin or padding, top or bottom. You can only apply margin and padding to the left or right of an element.
In your case. I'd put a class on the containing paragraph element and add margin to the top of that. Paragraph elements are block level elements.

how to fix the difference in line thickness for a collapsable element

I have a webpage that uses bootstrap accordion.
There is a line that divides sections. I have included a screenshot.
When the user clicks the 'Read More' the accordion opens.
The problem is that there are lines on the side for each section. When a section opens, the line follows the section, as it should. However, the thickness of the lines looks off. I can't figure out how to make this work so it looks the same opened or closed.
Code Shared on jsfiddle.net here
jQuery(".readmore").click(function () {
var thisid = jQuery(this).attr('id');
var id = thisid.split("-");
jQuery(".read-" + id[1] + "-text").slideDown();
jQuery(this).css("display", "none");
});
jQuery(".readclose").click(function () {
var thisid = jQuery(this).attr('id');
var id = thisid.split("-");
jQuery(".read-" + id[1] + "-text").slideUp();
jQuery("#read-" + id[1]).css("display", "block");
});
<div class="second-section">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="expect-head little-time">Big changes in little time</div>
<div class="expect-body hasborder-right">TeamUp was developed from over 30 years of coaching the world's top executives. We truly understand what it takes to achieve deep, meaningful life changes, even on a busy schedule.
<h3 class="readmore" id="read-1">> Read More</h3>
<div class="read-1-text" style="display:none;">Whether you choose to create a healthier lifestyle, deeper relationships, or seek more fulfillment in your career, TeamUp will take you there. You’ll discover your patterns of behavior and consciously choose which ones to keep and which ones to change. You'll experience your life from a new and refreshing perspective.
<h3 class="readclose" id="close-1">> Close</h3>
</div>
</div>
</div>
<div class="col-md-6">
<div class="expect-head results">Results that last a lifetime</div>
<div class="expect-body hasborder-left">This course is a all about taking action. The specific action to take is determined by you. There are no formulas or a one-size-fits-all. You define your own actions based upon what you want to do differently in your life.
<h3 class="readmore" id="read-2">> Read More</h3>
<div class="read-2-text" style="display:none;">You are creative and insightful. You probably already know what you want to change. Through your weekly interactions with your teammates, and the course material, you will turn your insights into action to achieve your personal growth goals.
<h3 class="readclose" id="close-2">> Close</h3>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="expect-head getsupport">Get Support from your team</div>
<div class="expect-body hasborder-right">Each week you'll have a 90-minute online conversation with your team members. They will listen, challenge and motivate you. You'll find the strength and courage to overcome any obstacles along the way.
<h3 class="readmore" id="read-3">> Read More</h3>
<div class="read-3-text" style="display:none;">You will also inspire change in the members of your team. You'll experience first hand how fulfilling it is contributing to others insights and personal growth. Working together is not only more effective...it's more fun.
<h3 class="readclose" id="close-3">> Close</h3>
</div>
</div>
</div>
<div class="col-md-6">
<div class="expect-head ontrack">We'll keep you on track</div>
<div class="expect-body hasborder-left">A dedicated coach facilitator will guide you, and your team throughout the course. All TeamUp facilitators have been throughly trained and mentored, maintaining the highest standards of confidentiality and integrity.
<h3 class="readmore" id="read-4">> Read More</h3>
<div class="read-4-text" style="display:none;">Our facilitators know what it takes to make long-lasting change, and will create a safe, inspirational learning environment where you can achieve profound personal growth.
<h3 class="readclose" id="close-4">> Close</h3>
</div>
</div>
</div>
</div>
</div>
</div>
.second-section {
border-bottom: 1px solid #666666;
}
.second-section h2 {
font-size: 56px;
text-align: center;
}
.second-section .container-fluid {
padding: 0;
}
.second-section .col-md-6 {
padding: 0;
width: 50%;
float:left;
}
.expect-head {
color: #000;
padding: 35px 50px;
text-align: left;
}
.expect-head h3 {
line-height: inherit;
}
.expect-body {
padding: 20px 50px;
min-height: 210px;
}
.expect-body b {
font-weight: 600;
}
.readmore, .readclose {
color: #FF7C00;
cursor: pointer;
display: block;
font-size: 18px;
font-weight: normal;
line-height: inherit;
margin-top: 30px;
}
.read-1-text, .read-2-text, .read-3-text, .read-4-text {
margin: 40px 0 0;
}
.hasborder-left {
border-left: 1px solid #666666;
}
.hasborder-right {
border-right: 1px solid #666666;
}
Any help appreciated.
It isn't that weird that this is happening, because you are putting two borders on the same place.
You say to your left div to output a border on the right and to output a border on the left of the most right div. This gives you two borders...
Therefore, you should remove one of them to get a singular border. If you want to have a thicker border, just change the pixel of the border you want to have.
See this for a demo: http://jsfiddle.net/8hp2X/2/
.hasborder-right {
border-right: 2px solid #666666;
}
As you can see, I have removed one of the borders, which results in a nice looking page.