asked    Myrna     2018-10-22       html       87 view        1 Answer

[SOLVED] CSS - align text to div

I'm struggling with aligning text to div.

I currently have this:

enter image description here

But I want to achieve this (I have just edited a screenshot to show you what I mean):

enter image description here

My code looks as follows:

HTML

<div class="regionHeader">
    <div class="regionArrow"></div>
    <h2>Some long header that should be aligned to the left next to the div with arrow</h2>
</div>

CSS

.regionHeader {
    border-bottom: 1px solid #ffd800;
    cursor: pointer;
}

.regionArrow {
    border-right: 4px solid #ffd800;
    border-bottom: 4px solid #ffd800;
    width: 13px;
    height: 13px;
    transform: rotate(45deg);
    float: left;
    margin-top: 11px;
    margin-right: 13px;
    margin-bottom: 0px;
    margin-left: 3px;
}

h2 {
    font-family: changa-regular;
    font-size: 2em;
}

I have already played with display and floats, but it either doesn't work or I'm doing it incorrectly.

  1 Answer  

        answered    Christopher     2018-10-22      

You can either simply use a padding-left on your heading:

.regionHeader {
  border-bottom: 1px solid #ffd800;
  cursor: pointer;
}

.regionArrow {
  border-right: 4px solid #ffd800;
  border-bottom: 4px solid #ffd800;
  width: 12px;
  height: 13px;
  transform: rotate(45deg);
  float: left;
  margin-top: 11px 13px 0 3px;
}

h2 {
  font-size: 2em;
  padding-left: 1.2em; /* <- added */
}
<div class="regionHeader">
  <div class="regionArrow"></div>
  <h2>Some long header that should be aligned to the left next to the div with arrow</h2>
</div>




Your Answer





 2018-10-22         Natalie

Add variables in specific section during link time

Consider the following situation:Variables X and Y are part of a library, let us call it lib.o. We do not have the possibility to adapt the corresponding source code of the library (e.g. like adding pragmas)X has to be linked to another section than Y, both are currently defined in the same sectionIs it possible (in general) for the linker to link individual variables out of a library to a specific (possibly new) section?The reasoning behind this question is that the library has a buffer overflow bug (memclr with to small buffer (variable X)) and overwrites variable Y. A te...
 linker                     2 answers                     63 view
 2018-10-22         Rod

Stray characters seen at output of snprintf

I have a string creating function in C which accepts an array of structs as it's argument and outputs a string based on a predefined format (like a list of list in python).Here's the functiontypedef struct{ PacketInfo_t PacketInfo; char Gnss60[1900]; //and other stuff...} Track_json_t;typedef struct { double latitude; double longitude;} GPSPoint_t;typedef struct{ UInt16 GPS_StatusCode; UInt32 fixtime; GPSPoint_t point; double altitude; unsigned char GPS_Satilite_Num;} GPS_periodic_t;unsigned short SendTrack(){ ...
 c                     2 answers                     70 view
 2018-10-22         Chester

Ada Exceptions in Safety Critical Embedded Systems

I started learning Ada for its potential use in an embedded device which is safety critical. So far, I'm really liking it. However, in my research on embedded programming, I came across the hot topic of whether to use exception handling in embedded systems. I think I understand why some people seem to avoid it:depending on its implementation it can introduce either run-time overhead or larger code size (mentioned here under "Implementation")the time it takes to execute exceptions can be non-deterministic (one of several sources I saw)Now my question is, Does the Ada languag...
 exception-handling                     2 answers                     65 view