How can I make this box in CSS (please see my image)?


Munira

In my divbox I have one bodyand headerpart. I want to give this headerpart a separate border which must be inside the div box and not have any padding. should indeed look like my given image:

image

Here is what I have tried:

HTML:

    <div id="story">
    <p>

    Story Header

    </p>
    story body.
   </div>

.CSS:

#story{

    border: 1px solid blue;
    padding:10px;

}
#story p{
    border: 1px solid blue;
    background-color:black;
    color:white;
}

Check it out here: Demo

turnip

You can use negative margins on headers.

#story{
    
    border: 1px solid blue;
    padding:10px;
    
}
#story p{
    border: 1px solid green;
    background-color:black;
    color:white;
    padding: 10px;
    margin: -11px -11px 10px -11px;
}
<div id="story">
    <p>
    Story Header     
    </p>
    story body.
</div>

JSFiddle version

Related


How can I make this box in CSS (please see my image)?

Munira In my divbox I have one bodyand headerpart. I want to give this headerpart a separate border which must be inside the div box and not have any padding. should indeed look like my given image: Here is what I have tried: HTML: <div id="story"> <p>

How to make my image box responsive using HTML and CSS

real john doe I'm trying to build a simple HTML and CSS card, I have a container with box-image and body-card, and the design works fine on the desktop version, but when I hit a media query breakpoint, my image doesn't Not shrinking with the container, when I

How can I make my Qt app see "Platform" elsewhere?

mogil I know that when a Qt application is installed somewhere, I need to deploy plugins in a folder that are related to the system used platforms. Traditionally, this folder should be where the executable is located. Well, I want to change this: I want to put

How can I make my Qt app see "Platform" elsewhere?

mogil I know that when a Qt application is installed somewhere, I need to deploy plugins in a folder that are related to the system used platforms. Traditionally, this folder should be where the executable is located. Well, I want to change this: I want to put

How can I make the browser see CSS and Javascript changes?

Thunder: CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see the changes made to these files without the user clearing their browser cache. There is also a need for a solution

How can I make the browser see CSS and Javascript changes?

Thunder: CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see the changes made to these files without the user clearing their browser cache. There is also a need for a solution

How can I make the browser see CSS and Javascript changes?

thunder: CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see the changes made to these files without the user clearing their browser cache. There is also a need for a solution

How can I make my flex-box buttons hover?

R. Clayton I have a flexbox with several different buttons, namely "Shop My Look", a social icon and a comment icon. I want them to hover over backgound-color: #ffff; (font) color: #f37761;and border color: #f37761. Apps :hoverhave no effect. Any ideas? You ca

How can I make my flex-box buttons hover?

R. Clayton I have a flexbox with several different buttons, namely "Shop My Look", a social icon and a comment icon. I want them to hover over backgound-color: #ffff; (font) color: #f37761;and border color: #f37761. Apps :hoverhave no effect. Any ideas? You ca

How can I make my box not touch the bottom of the page?

Andrzej Jestar I would like to know a way to make my box not touch the bottom of the page. I'm using Bootstrap 4 and tried the spacing utility but it doesn't seem to work. Here's the picture now, it's actually at the bottom of the page. .signup { position:ab

How can I make my box model display nicely?

Goodoff I don't understand why the margin-top CSS property is not showing in my div .inner. And I don't understand why my first .innerdiv 's border overflows his parent. I've thought about the drop in profits, I've tried many things, but nothing works. Here is

How can I make my input box outline disappear?

User 13493398 When I hover over the button, it shows the input box (as shown in Figure 1) My code is written like this: .search-btn{ position: relative; top: 30%; left: 30%; transform: translate(-50%,-50%); transition: all 1s; width: 50

How can I make my box model display nicely?

Goodoff I don't understand why the margin-top CSS property is not showing in my div .inner. And I don't understand why my first .innerdiv 's border overflows his parent. I've thought about the drop in profits, I've tried many things, but nothing works. Here is

How can I make my box react to any screen size

user agent I'm trying to create a responsive box if you check my pen . At the moment, if I scale down the page, the items start to hide. Is there any way to make this green box fit any mobile screen size? HTML: <div class="container"> <div class="card-detail

how can i see the inside of the content box

Mohamed Yassin Hi I would like to know how to see the content inside this box "" in the content of the stylesheet For example: I want to know the link of the image: .facebookicon::before { content: ""; } Simon West These square boxes usually mean that g

how can i see the inside of the content box

Mohamed Yassin Hi I would like to know how to see the content inside this box "" in the content of the stylesheet For example: I want to know the link of the image: .facebookicon::before { content: ""; } Simon West These square boxes usually mean that g

how can i see the inside of the content box

Mohamed Yassin Hi I would like to know how to see the content inside this box "" in the content of the stylesheet For example: I want to know the link of the image: .facebookicon::before { content: ""; } Simon West These square boxes usually mean that g

how can i see the inside of the content box

Mohamed Yassin Hi I would like to know how to see the content inside this box "" in the content of the stylesheet For example: I want to know the link of the image: .facebookicon::before { content: ""; } Simon West These square boxes usually mean that g

how can i see the inside of the content box

Mohamed Yassin Hi I would like to know how to see the content inside this box "" in the content of the stylesheet For example: I want to know the link of the image: .facebookicon::before { content: ""; } Simon West These square boxes usually mean that g

How to make an image inside a box responsive css

Coderhhz I'm having trouble modifying my site template. I have a total of four images and I want them to be displayed in the first row set, and the other three in the second row. By default, the template code has an arrangement to place three images side by si

How can I make my image smaller and smaller?

Nadav Himmelfarb When my browser size is less than 950px, my main image stops getting smaller and starts hiding behind the browser window. I tried changing the width, but then I started seeing my background color. Why is this happening and how can I fix it? He

How can I make my "logo" image appear in the header?

chpr486 I'm new to HTML and CSS, so sorry! I'm trying to add an image to the header to go to the left and above of the nav. Any help anyone can offer would be amazing! I've tried two ways to add an image, the first works, but it doesn't show (when I'm in the c

How can I make my "logo" image appear in the header?

chpr486 I'm new to HTML and CSS, so sorry! I'm trying to add an image to the header to go to the left and above of the nav. Any help anyone can offer would be amazing! I've tried two ways to add an image, the first works, but it doesn't show (when I'm in the c

How can I make my "logo" image appear in the header?

chpr486 I'm new to HTML and CSS, so sorry! I'm trying to add an image to the header to go to the left and above of the nav. Any help anyone can offer would be amazing! I've tried two ways to add an image, the first works, but it doesn't show (when I'm in the c

How can I make my image smaller and smaller?

Nadav Himmelfarb When my browser size is less than 950px, my main image stops getting smaller and starts hiding behind the browser window. I tried changing the width, but then I started seeing my background color. Why is this happening and how can I fix it? He

How can I make my "logo" image appear in the header?

chpr486 I'm new to HTML and CSS, so sorry! I'm trying to add an image to the header to go to the left and above of the nav. Any help anyone can offer would be amazing! I've tried two ways to add an image, the first works, but it doesn't show (when I'm in the c

How can I make my image DIV bigger in a scrollable div?

Paula I have a horizontal scrolling one divthat I have squared divs. I need to make these squares divsbigger, but I can't do it. In the example I provide here, there are 3 squared divs. Every time I add a new one, they get smaller. How can I prevent them from